text_html_output_2.png
from plotly.subplots import make_subplots

import pandas as pd

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

import plotly.graph_objects as go

train = pd.read_csv('../input/spaceship-titanic/train.csv')
test = pd.read_csv('../input/spaceship-titanic/test.csv')
submission = pd.read_csv('../input/spaceship-titanic/sample_submission.csv')
RANDOM_STATE = 12
FOLDS = 5
STRATEGY = 'median'

train.count()

test.count()

test.isna().sum().sort_values(ascending=False)

train.drop(columns=['PassengerId'], inplace=True)
test.drop(columns=['PassengerId'], inplace=True)
TARGET = 'Transported'
FEATURES = []
for col in train.columns:
    if col != TARGET:
        FEATURES.append(col)

train.iloc[:, :-1].describe().T.sort_values(by='mean', ascending=False)

test_null = pd.DataFrame(test.isna().sum())

test_null = test_null.sort_values(by=0, ascending=False)

train_null = pd.DataFrame(train.isna().sum())

train_null = train_null.sort_values(by=0, ascending=False)[:-1]

fig = make_subplots(rows=1, cols=2,
                    column_titles = ["Train Data", "Test Data",],
                    x_title = "Missing Values")

fig.add_trace(go.Bar(x=train_null[0], y=train_null.index, orientation='h', marker=dict(color=[n for n in range(12)])), 1, 1)
fig.add_trace(go.Bar(x=test_null[0], y=test_null.index, orientation='h', marker=dict(color=[n for n in range(12)])), 1, 2)
fig.update_layout(showlegend=False, title_text='Column wise Null Value Distribution', title_x=0.5)