Created
April 24, 2020 10:31
-
-
Save ShayanRiyaz/52de827d93a9c51f7e00a45a0368eab9 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
# one hot encoding | |
la_onehot = pd.get_dummies(la_venues[['Venue Category']], prefix="", prefix_sep="") | |
# add neighbourhood column back to data frame | |
la_onehot['Neighbourhood'] = la_venues['Neighbourhood'] | |
# move neighbourhood column to the first column | |
fixed_columns = [la_onehot.columns[-1]] + list(la_onehot.columns[:-1]) | |
la_onehot = la_onehot[fixed_columns] | |
la_onehot.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment