Spaces:
Sleeping
Sleeping
Update pages/1_Data_Validation.py
Browse files- pages/1_Data_Validation.py +24 -10
pages/1_Data_Validation.py
CHANGED
@@ -4,9 +4,7 @@ import plotly.express as px
|
|
4 |
import plotly.graph_objects as go
|
5 |
from Eda_functions import *
|
6 |
import numpy as np
|
7 |
-
import re
|
8 |
import pickle
|
9 |
-
from ydata_profiling import ProfileReport
|
10 |
from streamlit_pandas_profiling import st_profile_report
|
11 |
import streamlit as st
|
12 |
import streamlit.components.v1 as components
|
@@ -18,6 +16,9 @@ from st_aggrid import AgGrid
|
|
18 |
import base64
|
19 |
import os
|
20 |
import tempfile
|
|
|
|
|
|
|
21 |
|
22 |
st.set_page_config(
|
23 |
page_title="Data Validation",
|
@@ -105,20 +106,32 @@ def generate_report_with_target(channel_data, target_feature):
|
|
105 |
report.show_html(filepath=report_path, open_browser=False) # Generate the report as an HTML file
|
106 |
return report_path
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
st.header('Univariate and Bivariate Analysis')
|
110 |
eda_columns=st.columns(2)
|
111 |
with eda_columns[0]:
|
112 |
if st.button('Generate Profile Report'):
|
113 |
-
|
|
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
122 |
|
123 |
with eda_columns[1]:
|
124 |
if st.button('Generate Sweetviz Report'):
|
@@ -265,3 +278,4 @@ st.warning('Work in Progress')
|
|
265 |
# #st.write('You selected:', selected_options)
|
266 |
# st.pyplot(correlation_plot(df,selected_options,target_column))
|
267 |
|
|
|
|
4 |
import plotly.graph_objects as go
|
5 |
from Eda_functions import *
|
6 |
import numpy as np
|
|
|
7 |
import pickle
|
|
|
8 |
from streamlit_pandas_profiling import st_profile_report
|
9 |
import streamlit as st
|
10 |
import streamlit.components.v1 as components
|
|
|
16 |
import base64
|
17 |
import os
|
18 |
import tempfile
|
19 |
+
from ydata_profiling import ProfileReport
|
20 |
+
|
21 |
+
from streamlit_pandas_profiling import st_profile_report
|
22 |
|
23 |
st.set_page_config(
|
24 |
page_title="Data Validation",
|
|
|
106 |
report.show_html(filepath=report_path, open_browser=False) # Generate the report as an HTML file
|
107 |
return report_path
|
108 |
|
109 |
+
def generate_profile_report(df):
|
110 |
+
pr = df.profile_report()
|
111 |
+
temp_dir = tempfile.mkdtemp()
|
112 |
+
report_path = os.path.join(temp_dir, "report.html")
|
113 |
+
pr.to_file(report_path)
|
114 |
+
return report_path
|
115 |
+
|
116 |
|
117 |
st.header('Univariate and Bivariate Analysis')
|
118 |
eda_columns=st.columns(2)
|
119 |
with eda_columns[0]:
|
120 |
if st.button('Generate Profile Report'):
|
121 |
+
with st.spinner('Generating Report'):
|
122 |
+
report_file = generate_profile_report(st.session_state['cleaned_data'])
|
123 |
|
124 |
+
if os.path.exists(report_file):
|
125 |
+
with open(report_file, 'rb') as f:
|
126 |
+
st.success('Report Generated')
|
127 |
+
st.download_button(
|
128 |
+
label="Download EDA Report",
|
129 |
+
data=f.read(),
|
130 |
+
file_name="pandas_profiling_report.html",
|
131 |
+
mime="text/html"
|
132 |
+
)
|
133 |
+
else:
|
134 |
+
st.warning("Report generation failed. Unable to find the report file.")
|
135 |
|
136 |
with eda_columns[1]:
|
137 |
if st.button('Generate Sweetviz Report'):
|
|
|
278 |
# #st.write('You selected:', selected_options)
|
279 |
# st.pyplot(correlation_plot(df,selected_options,target_column))
|
280 |
|
281 |
+
|