#preliminaries import seaborn as sns import pandas as pd pd.options.display.max_rows = 10 df = sns.load_dataset("titanic")
df
891 rows × 15 columns
To see the current columns we can call the columns property
df.columns
Index(['survived', 'pclass', 'sex', 'age', 'sibsp', 'parch', 'fare', 'embarked', 'class', 'who', 'adult_male', 'deck', 'embark_town', 'alive', 'alone'], dtype='object')
df["new_column"] = 1
df.head()
df["new col 1"], df["new col 2"] = [2,3]
df["fare_squared"] = df.fare **2
df["fare + sibsp"] = df.fare + df.sibsp