python - Pandas Dataframe Plot -


i trying plot time series data. dataframe looks this

[1]:index  ship_date  cost_amount      0       1/8/2010  34276      1       1/8/2010  12375      2       1/8/2011  12343      3       2/9/2011  15435  [2]: df1.plot(figsize(20,5)) 

i trying plot data reason plot doesn't have x-axis in ascending order. how plot date ascending or descending order ? plot without dates in order

your problem (as spotted @ j richard snape) dates in fact strings it's ordered lexicographically.

you should convert datetime dtype:

df1['ship_date'] = pd.to_datetime(df1['ship_date']) 

after should maintain expected order.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -