Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import numpy as np
|
| 3 |
+
import streamlit as st
|
| 4 |
+
import matplotlib.pyplot as ply
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
st.set_page_config(page_title="Data analysis Portal", layout="wide")
|
| 8 |
+
st.title("Data analysis portal")
|
| 9 |
+
st.write("This will completely clean your data set")
|
| 10 |
+
|
| 11 |
+
uploaded_file = st.file_uploader("Upload File (CSV or Excel):", type=["csv","xlsx"], accept_multiple_files=True)
|
| 12 |
+
|
| 13 |
+
if uploaded_file:
|
| 14 |
+
for file in uploaded_file:
|
| 15 |
+
file_ext = os.path.splitext(file.name)[-1].lower()
|
| 16 |
+
|
| 17 |
+
if file_ext==".csv":
|
| 18 |
+
df = pd.read_csv(file)
|
| 19 |
+
if file_ext==".xlsx":
|
| 20 |
+
df = pd.read_csv(file)
|
| 21 |
+
else:
|
| 22 |
+
print(f"The file you have entered is = {file} is not in the accepted format")
|
| 23 |
+
continue
|
| 24 |
+
|
| 25 |
+
# display info of the file
|
| 26 |
+
st.write(f"**File Name:**{file.name}")
|
| 27 |
+
st.write(f"**File size:**{file.size/1024}")
|
| 28 |
+
|
| 29 |
+
# Show our data set
|
| 30 |
+
st.write("This will preview the dataset head")
|
| 31 |
+
st.dataframe(df.head())
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|