My goal is to analyze changes in tuition costs for private schools in urban settings vs private schools in rural settings.
I have a dataframe with tuition costs of all private schools in the US through time (tuit_cost
). The dataframe tuit_cost
contains columns of historical tuition costs as well as two columns titled ['State','City/Town Name']
.
I also have a separate dataframe of private schools that are classified as being in 'Urban' areas (urban_schools
). This dataframe has only two columns -- ['State','City/Town Name']
.
I merged the dataframes in order to create a dataframe with only the urban schools' historical tuition data.
urban_school_tuit = pd.merge(urban_schools, tuit_cost, how='left', left_on= ['State','City/Town Name'], right_on=['State','City/Town Name']).dropna()
Now I want to create a dataframe with only the rural schools' historical tuition data by dropping all of the rows in urban_school_tuit
from tuit_cost
.
What is the most efficient way to do so?
Thanks!