File size: 964 Bytes
26fde64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1ff0f5
26fde64
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
import pandas as pd
import numpy as np
import streamlit as st
import os 

st.set_page_config(page_title="Data analysis Portal", layout="wide")
st.title("Data analysis portal")
st.write("This will completely clean your data set")

uploaded_file = st.file_uploader("Upload File (CSV or Excel):", type=["csv","xlsx"], accept_multiple_files=True)

if uploaded_file:
    for file in uploaded_file:
        file_ext = os.path.splitext(file.name)[-1].lower()

        if file_ext==".csv":
            df = pd.read_csv(file)
        if file_ext==".xlsx":
            df = pd.read_excel(file)
        else:
            print(f"The file you have entered is = {file} is not in the accepted format")
            continue

        # display info of the file 
        st.write(f"**File Name:**{file.name}")
        st.write(f"**File size:**{file.size/1024}")

        # Show our data set
        st.write("This will preview the dataset head")
        st.dataframe(df.head())