IUM_s464980/get_stats.py

34 lines
1.1 KiB
Python

import pandas as pd
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
df = pd.read_csv('./dataset.csv')
df_train = pd.read_csv('./df_train.csv')
df_test = pd.read_csv('./df_test.csv')
with open('stats.txt', 'w') as f:
f.write(f"Wielkość całego zbioru:\n {df.shape}\n")
f.write(f"Wielkość treningowego zbioru:\n {df_train.shape}\n")
f.write(f"Wielkość testowego zbioru:\n {df_test.shape}\n")
f.write(f"\nStatystyki dla całego zbioru:\n")
f.write(f"{df.describe()}\n")
f.write(f"\nStatystyki dla treningowego zbioru:\n")
f.write(f"{df_train.describe()}\n")
f.write(f"\nStatystyki dla testowego zbioru:\n")
f.write(f"{df_test.describe()}\n")
f.write(f"\nRozkład zmiennej wyjściowej dla całości:\n")
f.write(f"{df['Performance Index'].value_counts()}\n")
f.write(f"\nRozkład zmiennej wyjściowej dla zbioru treningowego:\n")
f.write(f"{df_train['Performance Index'].value_counts()}\n")
f.write(f"\nRozkład zmiennej wyjściowej dla zbioru testowego:\n")
f.write(f"{df_test['Performance Index'].value_counts()}\n")