-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_data_app.py
47 lines (30 loc) · 1.37 KB
/
my_data_app.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
import streamlit as st
import pandas as pd
st.markdown("<h1 style='text-align: center; color: black;'>MY DATA APP</h1>", unsafe_allow_html=True)
st.markdown("""
This app allows you to download scraped data on motocycles from expat-dakar
**Python libraries:** base64, pandas, streamlit
**Data source:** [Expat-Dakar](https://www.expat-dakar.com/).
""")
# Fonction de loading des données
def load_(dataframe, title, key) :
st.markdown("""
<style>
div.stButton {text-align:center}
</style>""", unsafe_allow_html=True)
if st.button(title,key):
st.subheader('Display data dimension')
st.write('Data dimension: ' + str(dataframe.shape[0]) + ' rows and ' + str(dataframe.shape[1]) + ' columns.')
st.dataframe(dataframe)
# définir quelques styles liés aux box
st.markdown('''<style> .stButton>button {
font-size: 12px;
height: 3em;
width: 25em;
}</style>''', unsafe_allow_html=True)
# Charger les données
load_(pd.read_csv('data/motos_scooters1.csv'), 'Motocycles data 1', '1')
load_(pd.read_csv('data/motos_scooters2.csv'), 'Motocycles data 2', '2')
load_(pd.read_csv('data/motos_scooters3.csv'), 'Motocycles data 3', '3')
load_(pd.read_csv('data/motos_scooters4.csv'), 'Motocycles data 4', '4')
load_(pd.read_csv('data/motos_scooters5.csv'), 'Motocycles data 5', '5')