File size: 864 Bytes
da528de
bdd09b1
 
 
da528de
 
 
 
 
 
bdd09b1
da528de
 
bdd09b1
da528de
 
 
bdd09b1
da528de
bdd09b1
da528de
 
bdd09b1
da528de
 
bdd09b1
da528de
 
 
bdd09b1
da528de
 
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
28
29
30
31
32
33
import streamlit as st
import pandas as pd
import numpy as np

# Function to load data and replace missing values
@st.cache
def load_data():
    # Load your data here, assuming 'recent_grads' is your DataFrame
    # Replace 'your_data.csv' with your actual data file
    recent_grads = pd.read_csv('your_data.csv')

    # List of columns needing correction
    columns_to_correct = ['column1', 'column2', 'column3']  # Replace these with your columns

    # Replace 'UN' with NaN in specified columns
    for column in columns_to_correct:
        recent_grads.loc[recent_grads[column] == 'UN', column] = np.nan

    return recent_grads

def main():
    st.title('Data Handling with Streamlit')

    # Load data
    data = load_data()

    # Show the loaded data in Streamlit
    st.write("Original Data:")
    st.write(data)

if __name__ == "__main__":
    main()