text_html_output_1.png
import pandas as pd

test = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv')
test_pass_id = test.PassengerId.copy()

train = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv')
train_pass_id = train.PassengerId.copy()

X = train.drop(columns='Transported')
y = train[['Transported']]

df = pd.concat([X, test], ignore_index=True)

nan_inicial = df.isna().sum()
nan_inicial

df[['deck', 'num', 'side']] = df['Cabin'].str.split(pat='/', expand=True)
df[['Passenger', '_Id']] = df['PassengerId'].str.split(pat='_', expand=True)
df[['Nome', 'Sobrenome']] = df['Name'].str.split(pat=' ', expand=True)
df.drop(columns=['Cabin', 'Name'], inplace=True)
df.head()