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_vals = pd.read_csv('../input/richters-predictor-modeling-earthquake-damage/train_values.csv')
train_labels = pd.read_csv('../input/richters-predictor-modeling-earthquake-damage/train_labels.csv')

train_vals.dtypes.value_counts()

train_df = train_vals.merge(train_labels, on='building_id')

numericals = ['count_floors_pre_eq', 'height_percentage', 'area_percentage', 'count_families']

fig, axes = plt.subplots(2,2, figsize = (10,10))
for i, feature in enumerate(numericals):
    sns.histplot(data = train_df, x = feature, ax = axes[i%2, i//2], color = 'purple')
plt.show()

corr = train_df.corr()['damage_grade'].sort_values(ascending=False)[1:]
corr = corr[abs(corr.values) > 0.01]

plt.xticks(rotation=90)

cats = []
for column in train_df.columns:
    if train_df[column].dtype == 'object':
        cats.append(column)
for cat in cats:
    train_df[cat] = train_df[cat].astype('category')
len(cats)

sns.set_palette('colorblind')
fig, axes = plt.subplots(4, 2, figsize=(20, 20), sharex=False)
for i, name in enumerate(cats):
    sns.countplot(data=train_df, x=name, ax=axes[i % 4, i // 4])
plt.show()