ml_module1/analyze.py
2024-10-23 22:12:41 +03:00

40 lines
939 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import shapiro
import pandas as pd
data = pd.read_csv("cleared.csv")
columns_for_cor = [
"experience",
"employment",
"salary_min",
"salary_max",
"area_краснодар",
"area_москва",
"area_санкт-петербург"
]
data["area"] = data["area"].map(lambda area: str(area).lower())
data["area"] = data["area"].astype("string")
_, p_min = shapiro(data["salary_min"])
_, p_max = shapiro(data["salary_max"])
data.info()
sns.kdeplot(data[["salary_max","salary_min"]])
sns.boxplot(data[["salary_max","salary_min"]])
data = data.groupby("area").filter(lambda count: len(count) > 30)
data_dum = pd.get_dummies(data, columns=["area"])
print(data_dum.columns)
data_dum.info()
sns.heatmap(data_dum[columns_for_cor].corr())
plt.show()
print(data[["salary_min", "salary_max", "area"]].groupby("area").mean())
print(data.info())