pandas_basics.py 462 B

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