<jupyter_start><jupyter_text>Creating And Cleaning Features: Create Indicator  Read In Data<jupyter_code># Read in data
import numpy as np
import pandas as pd

titanic = pd.read_csv('../../../data/titanic_title.csv')
titanic.head()<jupyter_output><empty_output><jupyter_text>Create Indicator Variable For `Cabin`<jupyter_code># What would an indicator variable for Cabin look like?
titanic.groupby(titanic['Cabin'].isnull())['Survived'].mean()
# Create indicator feature
titanic['Cabin_ind'] = np.where(titanic['Cabin'].isnull(), 0, 1)
titanic.head()
# Create new CSV with updated data
titanic.to_csv('../../../data/titanic_cabin_ind.csv', index=False)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup