datasummer / app.py
AliUsama98's picture
Update app.py
da528de
raw
history blame contribute delete
864 Bytes
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()