Last active
October 23, 2020 10:14
-
-
Save BinarySpoon/73eff24708275a234923d5a890560006 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tag University Towns As True --> | |
uni_regions = get_list_of_university_towns() | |
uni_regions['Uni_regions'] = True | |
# merge housing data with uni_town df --? | |
data2 = pd.merge(housing_data,uni_regions,how='right', left_index=True,right_on=['State', 'RegionName']) | |
uni_towns = data2[data2['Uni_regions']==True]['Delta'] | |
# merge housing data with non-uni_town df --> | |
data3 = pd.merge(data,uni_regions,how='left',left_index=True,right_on=['State','RegionName']) | |
data3['Uni_regions'] = data3['Uni_regions'].replace({np.NaN: False}) | |
non_uni_towns = data3[data3['Uni_regions'] == False]['Delta'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment