Last active
September 28, 2019 17:53
-
-
Save vanessaaleung/2ec7ad1c23aedaaecac317dd4096821e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
sf_onehot = pd.get_dummies(sf_venues[['Venue Category']], prefix = "", prefix_sep = "") | |
# add neighborhood column back to dataframe | |
sf_onehot['Neighborhood'] = sf_venues['Neighborhood'] | |
# move neighborhood column to the first column | |
fixed_columns = [sf_onehot.columns[-1]] + list(sf_onehot.columns[:-1]) | |
sf_onehot = sf_onehot[fixed_columns] | |
sf_onehot.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment