pandas_basics.py 452 B

12345678910111213141516171819202122232425
  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3. from matplotlib import style
  4. style.use('ggplot')
  5. web_stats = {'Day': [1,2,3,4,5,6],
  6. 'Visitors': [54, 65, 76, 76, 34, 34],
  7. 'Bounce_Rate': [54, 23, 32, 54, 54, 32]}
  8. df = pd.DataFrame(web_stats)
  9. # print(df.head())
  10. df.set_index('Day', inplace = True)
  11. # print(df.index)
  12. df.Visitors.plot()
  13. # plt.show()
  14. print(df[['Visitors','Bounce_Rate']])
  15. ex_list = df.Visitors.tolist()
  16. print(ex_list)