text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

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

import seaborn as sns

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

train.dtypes.value_counts()

missing_vals_train = pd.DataFrame(train.isna().sum(), columns=['Sum'])
missing_vals_train = missing_vals_train.sort_values(by='Sum', ascending=False)
missing_vals_train = missing_vals_train[missing_vals_train['Sum'] > 0]
missing_vals_train['Percent'] = missing_vals_train['Sum'] / 8693 * 100
missing_vals_train

# categorical variable:  CryoSleep
fig, ax = plt.subplots(1,2, figsize =(10, 5))
sns.countplot(data=train, x='CryoSleep', ax=ax[0])
sns.countplot(data=train, x='CryoSleep', hue='Transported', ax=ax[1])

fig, axs = plt.subplots(3, 3, figsize=(17, 10))
sns.countplot(data=train, x='HomePlanet', hue='CryoSleep', ax=axs[0, 0])
sns.violinplot(train, x='CryoSleep', y='Age', ax=axs[0, 1])
sns.countplot(data=train, x='VIP', hue='CryoSleep', ax=axs[0, 2])
sns.violinplot(train, x='CryoSleep', y='FoodCourt', ax=axs[1, 0])
sns.violinplot(train, x='CryoSleep', y='ShoppingMall', ax=axs[1, 1])
sns.violinplot(train, x='CryoSleep', y='Spa', ax=axs[1, 2])
sns.violinplot(train, x='CryoSleep', y='VRDeck', ax=axs[2, 0])
sns.violinplot(train, x='CryoSleep', y='RoomService', ax=axs[2, 1])
sns.countplot(data=train, x='Destination', hue='CryoSleep', ax=axs[2, 2])