-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheda.py
More file actions
28 lines (23 loc) · 870 Bytes
/
eda.py
File metadata and controls
28 lines (23 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Función para mostrar estadísticas descriptivas y análisis general
def eda(df):
# Mostrar estadísticas descriptivas
st.write("Estadísticas descriptivas del dataset:")
st.write(df.describe())
# Verificar valores nulos
st.write("Valores nulos por columna:")
st.write(df.isnull().sum())
# Visualización de distribuciones de variables
st.write("Distribución de la variable 'age':")
sns.histplot(df['age'], kde=True)
st.pyplot()
st.write("Distribución de la variable 'hours.per.week':")
sns.histplot(df['hours.per.week'], kde=True)
st.pyplot()
# Correlación entre variables numéricas
st.write("Mapa de calor de correlación:")
corr = df.corr()
sns.heatmap(corr, annot=True, cmap="coolwarm", fmt=".2f")
st.pyplot()