sourize commited on
Commit
b52ec8d
Β·
verified Β·
1 Parent(s): 83e27d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -67
app.py CHANGED
@@ -1,68 +1,68 @@
1
- import pandas as pd
2
- import plotly.express as px
3
- import streamlit as st
4
-
5
- st.set_page_config(
6
- page_title='Data Analytics Portal',
7
- page_icon='πŸ“Š'
8
- )
9
-
10
- st.title(':blue[πŸ“Š Data Analytics Portal]')
11
- st.subheader(':grey[ An easy way to Analyse Data!!]', divider='green')
12
-
13
- file = st.file_uploader('Drop csv or excel file', type=['csv', 'xlsx'])
14
- if file:
15
- if file.name.endswith('csv'):
16
- data = pd.read_csv(file)
17
- else:
18
- data = pd.read_excel(file)
19
- st.dataframe(data)
20
- st.info('File is successfully Uploaded', icon='🚨')
21
-
22
- st.subheader(':blue[Basic information of the dataset]', divider='green')
23
-
24
- tab1, tab2, tab3, tab4 = st.tabs(['Summary', 'Top and Bottom Rows', 'Data Types', 'Columns'])
25
-
26
- with tab1:
27
- st.write(f'There are {data.shape[0]} rows in dataset and {data.shape[1]} columns in the dataset')
28
- st.subheader(':gray[Statistical summary of the dataset]')
29
- st.dataframe(data.describe())
30
-
31
- with tab2:
32
- st.subheader(':gray[Top Rows]')
33
- toprows = st.slider('Number of rows you want', 1, data.shape[0], key='topslider')
34
- st.dataframe(data.head(toprows))
35
- st.subheader(':gray[Bottom Rows]')
36
- bottomrows = st.slider('Number of rows you want', 1, data.shape[0], key='bottomslider')
37
- st.dataframe(data.tail(bottomrows))
38
-
39
- with tab3:
40
- st.subheader(':grey[Data types of column]')
41
- st.dataframe(data.dtypes)
42
-
43
- with tab4:
44
- st.subheader('Column Names in Dataset')
45
- st.write(list(data.columns))
46
-
47
- st.subheader(':blue[Column Values To Count]', divider='green')
48
-
49
- with st.expander('Value Count'):
50
- col1, col2 = st.columns(2)
51
- with col1:
52
- column = st.selectbox('Choose Column name', options=list(data.columns))
53
- with col2:
54
- toprows = st.number_input('Top rows', min_value=1, step=1)
55
-
56
- count = st.button('Count')
57
- if count:
58
- result = data[column].value_counts().reset_index().head(toprows)
59
- st.dataframe(result)
60
- st.subheader('Visualization', divider='gray')
61
- fig = px.bar(data_frame=result, x=column, y='count', text='count', template='plotly_white')
62
- st.plotly_chart(fig)
63
- fig = px.line(data_frame=result, x=column, y='count', text='count', template='plotly_white')
64
- st.plotly_chart(fig)
65
- fig = px.pie(data_frame=result, names=column, values='count')
66
- st.plotly_chart(fig)
67
- else:
68
  st.warning('Please upload a CSV or Excel file to get started', icon='⚠️')
 
1
+ import pandas as pd
2
+ import plotly.express as px
3
+ import streamlit as st
4
+
5
+ st.set_page_config(
6
+ page_title='Data Analytics Portal',
7
+ page_icon='πŸ“Š'
8
+ )
9
+
10
+ st.title(':blue[πŸ“Š Data Analytics Portal]')
11
+ st.subheader(':grey[ An easy way to Analyse Data!!]', divider='green')
12
+
13
+ file = st.file_uploader('Drop CSV or Excel file', type=['csv', 'xlsx'])
14
+ if file:
15
+ if file.name.endswith('csv'):
16
+ data = pd.read_csv(file)
17
+ else:
18
+ data = pd.read_excel(file)
19
+ st.dataframe(data)
20
+ st.info('File is successfully Uploaded', icon='🚨')
21
+
22
+ st.subheader(':blue[Basic information of the dataset]', divider='green')
23
+
24
+ tab1, tab2, tab3, tab4 = st.tabs(['Summary', 'Top and Bottom Rows', 'Data Types', 'Columns'])
25
+
26
+ with tab1:
27
+ st.write(f'There are {data.shape[0]} rows in dataset and {data.shape[1]} columns in the dataset')
28
+ st.subheader(':gray[Statistical summary of the dataset]')
29
+ st.dataframe(data.describe())
30
+
31
+ with tab2:
32
+ st.subheader(':gray[Top Rows]')
33
+ toprows = st.slider('Number of rows you want', 1, data.shape[0], key='topslider')
34
+ st.dataframe(data.head(toprows))
35
+ st.subheader(':gray[Bottom Rows]')
36
+ bottomrows = st.slider('Number of rows you want', 1, data.shape[0], key='bottomslider')
37
+ st.dataframe(data.tail(bottomrows))
38
+
39
+ with tab3:
40
+ st.subheader(':grey[Data types of column]')
41
+ st.dataframe(data.dtypes)
42
+
43
+ with tab4:
44
+ st.subheader('Column Names in Dataset')
45
+ st.write(list(data.columns))
46
+
47
+ st.subheader(':blue[Column Values To Count]', divider='green')
48
+
49
+ with st.expander('Value Count'):
50
+ col1, col2 = st.columns(2)
51
+ with col1:
52
+ column = st.selectbox('Choose Column name', options=list(data.columns))
53
+ with col2:
54
+ toprows = st.number_input('Top rows', min_value=1, step=1)
55
+
56
+ count = st.button('Count')
57
+ if count:
58
+ result = data[column].value_counts().reset_index().head(toprows)
59
+ st.dataframe(result)
60
+ st.subheader('Visualization', divider='gray')
61
+ fig = px.bar(data_frame=result, x=column, y='count', text='count', template='plotly_white')
62
+ st.plotly_chart(fig)
63
+ fig = px.line(data_frame=result, x=column, y='count', text='count', template='plotly_white')
64
+ st.plotly_chart(fig)
65
+ fig = px.pie(data_frame=result, names=column, values='count')
66
+ st.plotly_chart(fig)
67
+ else:
68
  st.warning('Please upload a CSV or Excel file to get started', icon='⚠️')