Reputation: 806
I would need to plot accounts through time, by sorting opening account.
I have the following two columns, one for the Accounts and one for OpenTime (it is datetime):
Account Name OpenTime
ABC 2002/05/20
BAB 2012/07/24
CMN 2012/07/24
GKS 2001/12/05
EIR 2018/04/21
I would like to see on the chart Account Names in the following order:
GKS ABC BAB,CMN EIR
How can I get this result?
Upvotes: 0
Views: 57
Reputation: 626
import matplotlib.pyplot as plt
plt.plot( da['Account Name'],da['OpenTime'], 'o-', linewidth=2)
does this answers plotting part?
Upvotes: 0
Reputation: 323396
First we need convert the date to datetime , then sort_values
df.OpenTime=pd.to_datetime(df.OpenTime)
df=df.sort_values('OpenTime')
print(df['Account Name'].tolist())
Upvotes: 1