SHARE
TWEET

Pandas - plot

furas Jul 14th, 2018 (edited) 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top