Advertisement
furas

Pandas - plot

Jul 14th, 2018
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3.  
  4. df = pd.DataFrame({
  5.     'time': ['2018-01-01', '2018-01-02', '2018-01-03'],
  6.     'place': ['A', 'B', 'C'],
  7.     'magnitude': [-4, 3, 2],
  8. })
  9.  
  10. print(df)
  11.  
  12. df['time'] = pd.to_datetime(df['time'])
  13.  
  14. df.plot(x='time', y='magnitude')
  15. plt.show()
  16.  
  17. df.plot(x='magnitude', y='time')
  18. plt.show()
  19.  
  20. # --------------------------------------
  21.  
  22. print('wrong data')
  23.      
  24. new = pd.DataFrame()
  25. new.append( df['time'] )
  26. print(new)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement