Spaces:
Running
Running
AliUsama98
commited on
Commit
•
56df817
1
Parent(s):
173f7b1
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
# Function to load data and replace missing values
|
6 |
+
@st.cache
|
7 |
+
def load_data():
|
8 |
+
# Load your data here, assuming 'recent_grads' is your DataFrame
|
9 |
+
# Replace 'your_data.csv' with your actual data file
|
10 |
+
recent_grads = pd.read_csv('your_data.csv')
|
11 |
+
|
12 |
+
# List of columns needing correction
|
13 |
+
columns_to_correct = ['column1', 'column2', 'column3'] # Replace these with your columns
|
14 |
+
|
15 |
+
# Replace 'UN' with NaN in specified columns
|
16 |
+
for column in columns_to_correct:
|
17 |
+
recent_grads.loc[recent_grads[column] == 'UN', column] = np.nan
|
18 |
+
|
19 |
+
return recent_grads
|
20 |
+
|
21 |
+
def main():
|
22 |
+
st.title('Data Handling with Streamlit')
|
23 |
+
|
24 |
+
# Load data
|
25 |
+
data = load_data()
|
26 |
+
|
27 |
+
# Show the loaded data in Streamlit
|
28 |
+
st.write("Original Data:")
|
29 |
+
st.write(data)
|
30 |
+
|
31 |
+
if __name__ == "__main__":
|
32 |
+
main()
|