Advertisement
makispaiktis

Kaggle - Exercise 2 - Lineplots

Jul 1st, 2023 (edited)
1,392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. import pandas as pd
  2. pd.plotting.register_matplotlib_converters()
  3. import matplotlib.pyplot as plt
  4. # %matplotlib inline
  5. import seaborn as sns
  6. print("Setup Complete")
  7.  
  8. """
  9. # Set up code checking
  10. import os
  11. if not os.path.exists("../input/museum_visitors.csv"):
  12.    os.symlink("../input/data-for-datavis/museum_visitors.csv", "../input/museum_visitors.csv")
  13. from learntools.core import binder
  14. binder.bind(globals())
  15. from learntools.data_viz_to_coder.ex2 import *
  16. print("Setup Complete")
  17. """
  18.  
  19.  
  20.  
  21. # 1. Read the CSV file
  22. museum_filepath = "../input/museum_visitors.csv"
  23. museum_data = pd.read_csv(museum_filepath, index_col="Date", parse_dates=True)
  24. museum_data.tail()
  25. # How many visitors did the Chinese American Museum receive in July 2018?
  26. ca_museum_jul18 = 2620
  27. # How many more visitors did Avila Adobe receive than the Firehouse Museum?
  28. avila_oct18 = 19280 - 4622
  29.  
  30.  
  31. # 2. Show the lineplots for all the museums and for only 1 museum after that
  32. sns.lineplot(data=museum_data)
  33. sns.lineplot(data=museum_data['Avila Adobe'], label="Avila Adobe")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement