Spaces:
Runtime error
Runtime error
Commit
·
3b7db7f
1
Parent(s):
9ac3994
Added checkboxes for cleaning options.
Browse files- app.py +11 -6
- modules.py +1 -1
app.py
CHANGED
|
@@ -15,14 +15,19 @@ uploaded_file = st.file_uploader(f"Upload dataset:", type=modules.SUPPORTED_TYPE
|
|
| 15 |
df, (filename, extension), result = modules.load_file(uploaded_file)
|
| 16 |
st.text(result)
|
| 17 |
|
| 18 |
-
|
| 19 |
-
st.
|
|
|
|
| 20 |
|
| 21 |
-
st.
|
| 22 |
-
|
| 23 |
-
st.dataframe(df)
|
| 24 |
|
| 25 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
st.markdown("---")
|
| 28 |
st.text("Created by team #2hack2furious for the hackthethreat2023")
|
|
|
|
| 15 |
df, (filename, extension), result = modules.load_file(uploaded_file)
|
| 16 |
st.text(result)
|
| 17 |
|
| 18 |
+
if df is not None:
|
| 19 |
+
st.title("Before:")
|
| 20 |
+
st.dataframe(df)
|
| 21 |
|
| 22 |
+
drop_missing = st.checkbox("Drop Missing", True)
|
| 23 |
+
remove_duplicates = st.checkbox("Remove Duplicates", True)
|
|
|
|
| 24 |
|
| 25 |
+
st.title("After:")
|
| 26 |
+
df = modules.data_cleaner(df, drop_missing, remove_duplicates)
|
| 27 |
+
st.dataframe(df)
|
| 28 |
+
|
| 29 |
+
download_file = modules.create_file(df, extension)
|
| 30 |
+
st.download_button("Download cleaned data", download_file, file_name=filename)
|
| 31 |
|
| 32 |
st.markdown("---")
|
| 33 |
st.text("Created by team #2hack2furious for the hackthethreat2023")
|
modules.py
CHANGED
|
@@ -13,7 +13,7 @@ def load_file(file):
|
|
| 13 |
@rtype: tuple
|
| 14 |
@return: A tuple of format (pd.DataFrame, (str, str), str).
|
| 15 |
"""
|
| 16 |
-
df =
|
| 17 |
|
| 18 |
if file is None: return df, ("", ""), ""
|
| 19 |
|
|
|
|
| 13 |
@rtype: tuple
|
| 14 |
@return: A tuple of format (pd.DataFrame, (str, str), str).
|
| 15 |
"""
|
| 16 |
+
df = None
|
| 17 |
|
| 18 |
if file is None: return df, ("", ""), ""
|
| 19 |
|