Skip to content

Instantly share code, notes, and snippets.

@mmmayo13
Last active August 18, 2018 19:06
Show Gist options
  • Save mmmayo13/b9ffaea774058ec2a267055de775a276 to your computer and use it in GitHub Desktop.
Save mmmayo13/b9ffaea774058ec2a267055de775a276 to your computer and use it in GitHub Desktop.
# Determine if the passenger is alone or with family
titanic_full['Alone'] = np.where((titanic_full['SibSp']==0) & (titanic_full['Parch']==0), 1, 0)
# Drop SibSp & Parch
titanic_full.drop(['SibSp'], axis=1, inplace=True)
titanic_full.drop(['Parch'], axis=1, inplace=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment