text_plain_output_1.png
import math

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

train = pd.read_csv('/kaggle/input/playground-series-s3e14/train.csv')
test = pd.read_csv('/kaggle/input/playground-series-s3e14/test.csv')
original = pd.read_csv('/kaggle/input/originall/dataa.csv')

original = original.rename(columns={'Row': 'id'})

desc = train.describe().T
desc['nunique'] = train.nunique()
desc['%unique'] = desc['nunique'] / len(train) * 100
desc['null'] = train.isna().sum()
desc['type'] = train.dtypes
desc.head(60)

desc = test.describe().T
desc['nunique'] = test.nunique()
desc['%unique'] = desc['nunique'] / len(test) * 100
desc['null'] = test.isna().sum()
desc['type'] = test.dtypes
desc.head(60)

import math
train_data = train.drop(columns=['id', 'yield'], axis=1)
test_data = test.drop(columns='id', axis=1)
original_data = original.drop(columns=['yield', 'id'], axis=1)
numerical_columns = train_data.select_dtypes(include=['float64', 'int64']).columns.tolist()
num_plots = len(numerical_columns)
num_rows = math.ceil(num_plots / 3)
num_cols = min(num_plots, 3)
fig, axes = plt.subplots(nrows=num_rows, ncols=num_cols, figsize=(12, 4 * num_rows))
plot_idx = 0
for i in range(num_rows):
    for j in range(num_cols):
        if plot_idx >= num_plots:
            break
        if train[numerical_columns[plot_idx]].count() > 0 and test[numerical_columns[plot_idx]].count() > 0:
            sns.kdeplot(train_data[numerical_columns[plot_idx]], ax=axes[i][j], color='red', label='train')
            sns.kdeplot(test_data[numerical_columns[plot_idx]], ax=axes[i][j], color='green', label='test')
            sns.kdeplot(original_data[numerical_columns[plot_idx]], ax=axes[i][j], color='yellow', label='original')
            axes[i][j].set_xlabel(numerical_columns[plot_idx])
            axes[i][j].legend()
            plot_idx += 1
        else:
            axes[i][j].axis('off')
plt.tight_layout()
plt.show()