|
a |
|
b/Tabs/data.py |
|
|
1 |
"""This modules contains data about home page""" |
|
|
2 |
|
|
|
3 |
# Import necessary modules |
|
|
4 |
import streamlit as st |
|
|
5 |
|
|
|
6 |
|
|
|
7 |
def app(df): |
|
|
8 |
"""This function create the Data Info page""" |
|
|
9 |
|
|
|
10 |
# Add title to the page |
|
|
11 |
st.title("Data Info page") |
|
|
12 |
|
|
|
13 |
# Add subheader for the section |
|
|
14 |
st.subheader("View Data") |
|
|
15 |
|
|
|
16 |
# Create an expansion option to check the data |
|
|
17 |
with st.expander("View data"): |
|
|
18 |
st.dataframe(df) |
|
|
19 |
|
|
|
20 |
# Create a section to columns values |
|
|
21 |
# Give subheader |
|
|
22 |
st.subheader("Columns Description:") |
|
|
23 |
|
|
|
24 |
# Create a checkbox to get the summary. |
|
|
25 |
if st.checkbox("View Summary"): |
|
|
26 |
st.dataframe(df.describe()) |
|
|
27 |
|
|
|
28 |
# Create multiple check box in row |
|
|
29 |
col_name, col_dtype, col_data = st.columns(3) |
|
|
30 |
|
|
|
31 |
# Show name of all dataframe |
|
|
32 |
with col_name: |
|
|
33 |
if st.checkbox("Column Names"): |
|
|
34 |
st.dataframe(df.columns) |
|
|
35 |
|
|
|
36 |
# Show datatype of all columns |
|
|
37 |
with col_dtype: |
|
|
38 |
if st.checkbox("Columns data types"): |
|
|
39 |
dtypes = df.dtypes.apply(lambda x: x.name) |
|
|
40 |
st.dataframe(dtypes) |
|
|
41 |
|
|
|
42 |
# Show data for each columns |
|
|
43 |
with col_data: |
|
|
44 |
if st.checkbox("Columns Data"): |
|
|
45 |
col = st.selectbox("Column Name", list(df.columns)) |
|
|
46 |
st.dataframe(df[col]) |
|
|
47 |
|
|
|
48 |
# Add the link to you dataset |
|
|
49 |
st.markdown(""" |
|
|
50 |
<p style="font-size:24px"> |
|
|
51 |
<a |
|
|
52 |
href="https://raw.githubusercontent.com/DataMinati/Streamlit-Database/main/Parkinsson%20disease.csv" |
|
|
53 |
target=_blank |
|
|
54 |
style="text-decoration:none;" |
|
|
55 |
>Get Dataset |
|
|
56 |
</a> |
|
|
57 |
</p> |
|
|
58 |
""", unsafe_allow_html=True |
|
|
59 |
) |