Spaces:
Sleeping
Sleeping
cambios
Browse files- analisis.py +3 -6
analisis.py
CHANGED
|
@@ -79,15 +79,13 @@ class AnalizadorDatos:
|
|
| 79 |
|
| 80 |
def generar_graficos(self, columnas_analisis: list) -> dict:
|
| 81 |
"""Genera gráficos para las columnas especificadas"""
|
| 82 |
-
|
| 83 |
-
graficos_dir = "/tmp/graficos"
|
| 84 |
-
os.makedirs(graficos_dir, exist_ok=True)
|
| 85 |
|
| 86 |
for col in columnas_analisis:
|
| 87 |
if col not in self.df.columns:
|
| 88 |
continue
|
| 89 |
|
| 90 |
-
output_path =
|
| 91 |
|
| 92 |
if pd.api.types.is_numeric_dtype(self.df[col]):
|
| 93 |
path = generar_histograma_r(self.df, col, output_path)
|
|
@@ -99,8 +97,7 @@ class AnalizadorDatos:
|
|
| 99 |
if pd.api.types.is_categorical_dtype(self.df[c])
|
| 100 |
or pd.api.types.is_object_dtype(self.df[c])]
|
| 101 |
if categoricas and len(self.df[categoricas[0]].unique()) <= 10:
|
| 102 |
-
|
| 103 |
-
path = generar_boxplot_r(self.df, col, categoricas[0], boxplot_path)
|
| 104 |
if path:
|
| 105 |
self.graficos[f"{col}_by_{categoricas[0]}"] = {'tipo': 'boxplot', 'path': path}
|
| 106 |
else:
|
|
|
|
| 79 |
|
| 80 |
def generar_graficos(self, columnas_analisis: list) -> dict:
|
| 81 |
"""Genera gráficos para las columnas especificadas"""
|
| 82 |
+
os.makedirs("graficos", exist_ok=True)
|
|
|
|
|
|
|
| 83 |
|
| 84 |
for col in columnas_analisis:
|
| 85 |
if col not in self.df.columns:
|
| 86 |
continue
|
| 87 |
|
| 88 |
+
output_path = f"graficos/{col}.png"
|
| 89 |
|
| 90 |
if pd.api.types.is_numeric_dtype(self.df[col]):
|
| 91 |
path = generar_histograma_r(self.df, col, output_path)
|
|
|
|
| 97 |
if pd.api.types.is_categorical_dtype(self.df[c])
|
| 98 |
or pd.api.types.is_object_dtype(self.df[c])]
|
| 99 |
if categoricas and len(self.df[categoricas[0]].unique()) <= 10:
|
| 100 |
+
path = generar_boxplot_r(self.df, col, categoricas[0], f"graficos/{col}_by_{categoricas[0]}.png")
|
|
|
|
| 101 |
if path:
|
| 102 |
self.graficos[f"{col}_by_{categoricas[0]}"] = {'tipo': 'boxplot', 'path': path}
|
| 103 |
else:
|