text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

data = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv')
sub = pd.read_csv('/kaggle/input/spaceship-titanic/sample_submission.csv')
test = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv')

data.isnull().sum()

test.isnull().sum()

data.HomePlanet.unique()

data.dropna(subset=['Cabin'], inplace=True)
test.dropna(subset=['Cabin'], inplace=True)

data.isnull().sum()

test.isnull().sum()

data.drop(columns=['RoomService', 'FoodCourt', 'ShoppingMall', 'Spa', 'VRDeck', 'Cabin', 'Name'], inplace=True)
test.drop(columns=['RoomService', 'FoodCourt', 'ShoppingMall', 'Spa', 'VRDeck', 'Cabin', 'Name'], inplace=True)

data_1 = pd.get_dummies(data, columns=['CryoSleep', 'side', 'deck', 'HomePlanet', 'Destination'])
data_1['Transported'] = data_1['Transported'].astype(float)
data_1['VIP'] = data_1['VIP'].astype(float)

from sklearn.ensemble import RandomForestRegressor
X = data_1.drop(columns=['PassengerId'])
X = X.drop(columns=['Transported'])
X.head()