Commit
•
3275b57
1
Parent(s):
ca3261b
Update app.py
Browse files
app.py
CHANGED
@@ -14,14 +14,21 @@ def generate_report(file, type):
|
|
14 |
temp_file1 = NamedTemporaryFile(delete=False, suffix=".html")
|
15 |
temp_file1.write(pandas_html_report.encode('utf-8'))
|
16 |
temp_file1.close()
|
17 |
-
|
18 |
|
19 |
# dataprep_report = create_report(df)
|
20 |
# temp_file2 = NamedTemporaryFile(delete=False, suffix=".html")
|
21 |
# temp_file2.write(dataprep_report.encode('utf-8'))
|
22 |
# temp_file2.close()
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
sweetviz_report = sv.analyze(df)
|
27 |
#sweetviz_report=sweetviz_report.show_html()
|
@@ -34,6 +41,7 @@ def generate_report(file, type):
|
|
34 |
|
35 |
# Reading the file and storing in a variable
|
36 |
contents = HTMLFileToBeOpened.read()
|
|
|
37 |
|
38 |
|
39 |
temp_file3 = NamedTemporaryFile(delete=False, suffix=".html")
|
|
|
14 |
temp_file1 = NamedTemporaryFile(delete=False, suffix=".html")
|
15 |
temp_file1.write(pandas_html_report.encode('utf-8'))
|
16 |
temp_file1.close()
|
17 |
+
print('Pandas completed')
|
18 |
|
19 |
# dataprep_report = create_report(df)
|
20 |
# temp_file2 = NamedTemporaryFile(delete=False, suffix=".html")
|
21 |
# temp_file2.write(dataprep_report.encode('utf-8'))
|
22 |
# temp_file2.close()
|
23 |
|
24 |
+
def convert_mixed_to_str(df):
|
25 |
+
|
26 |
+
mixed_cols = df.select_dtypes(include=['object']).columns # Detect object dtype (usually mixed)
|
27 |
+
for col in mixed_cols:
|
28 |
+
df[col] = df[col].astype(str) # Convert mixed columns to strings
|
29 |
+
return df
|
30 |
+
|
31 |
+
df = convert_mixed_to_str(df.copy())
|
32 |
|
33 |
sweetviz_report = sv.analyze(df)
|
34 |
#sweetviz_report=sweetviz_report.show_html()
|
|
|
41 |
|
42 |
# Reading the file and storing in a variable
|
43 |
contents = HTMLFileToBeOpened.read()
|
44 |
+
print('Pandas completed')
|
45 |
|
46 |
|
47 |
temp_file3 = NamedTemporaryFile(delete=False, suffix=".html")
|