-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmissing-value-ratio
27 lines (21 loc) · 942 Bytes
/
missing-value-ratio
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
import pandas as pd
import streamlit as st
# Step 1: Read the CSV file into a Pandas DataFrame
file_path = "your_data.csv"
df = pd.read_csv(file_path)
# Step 2: Compute the missing values and missing values ratio
missing_values_count = df.isnull().sum()
missing_values_ratio = (df.isnull().sum() / len(df))
# Step 3: Create a table showing missing values and missing values ratio
missing_info_df = pd.DataFrame({
"Missing Values Count": missing_values_count,
"Missing Values Ratio": missing_values_ratio.map("{:.2%}".format)
})
# Step 4: Sort the DataFrame in descending order based on "Missing Values Count"
missing_info_df = missing_info_df.sort_values(by="Missing Values Count", ascending=False)
# Step 5: Display the sorted table
st.write("Missing Values Information (Descending Order):")
st.dataframe(missing_info_df)
# Finally, run your Streamlit app
if __name__ == "__main__":
st.set_page_config(page_title="Your Streamlit App")