Code
import pandas as pd
np_data = pd.read_csv("https://raw.githubusercontent.com/melaniewalsh/responsible-datasets-in-context/main/datasets/national-parks/US-National-Parks_RecreationVisits_1979-2024.csv")
np_data.head()February 26, 2024
These exercises use National Park visitation data from 1979–2024. For more context about the dataset, see the data essay.
Concepts covered:
Select 2 columns from the data. Save this 2-column dataframe to the variable smaller_df.
How does the number of visits to Washington national parks compare to another state?
Filter the dataframe for only values in the state of Washington and save to the variable wa_parks.
Calculate the sum total of RecreationVisits to Washington by using .sum() on the smaller dataframe wa_parks.
Filter the dataframe for only values in another state (your choice) and save to a variable. Calculate the sum total of RecreationVisits to this state by using .sum().
How do the number of visits to these 2 states compare to one another?