Created
September 18, 2019 09:07
-
-
Save lakshay-arora/58fa758b24d0592db2613e91fdb5d769 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
# save the top cities in a list | |
top_cities = ['Brooklyn','Bronx','Manhattan','Jamaica','Long Island City'] | |
# use loc to update the target | |
data.loc[(data.City.isin(top_cities) == False),'City'] = 'Others' | |
# city value counts | |
data.City.value_counts() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment