Skip to content

Instantly share code, notes, and snippets.

@mmmayo13
Created March 21, 2018 23:06
Show Gist options
  • Save mmmayo13/b2feb567a14d5b96122e8116c17f4c30 to your computer and use it in GitHub Desktop.
Save mmmayo13/b2feb567a14d5b96122e8116c17f4c30 to your computer and use it in GitHub Desktop.
titanic_full = pd.concat([titanic_full.drop('Pclass', axis=1), pd.get_dummies(titanic_full['Pclass'], prefix='Class')], axis=1)
titanic_full = pd.concat([titanic_full.drop('Embarked', axis=1), pd.get_dummies(titanic_full['Embarked'], prefix='Embarked')], axis=1)
titanic_full = pd.concat([titanic_full.drop('Title', axis=1), pd.get_dummies(titanic_full['Title'], prefix='Title')], axis=1)
titanic_full.name = 'titanic_full' # need to reset, as this is a copy of original df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment