File size: 1,268 Bytes
e93c297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea16f8d
 
f2e9233
ea16f8d
 
e93c297
 
 
 
 
 
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
import pandas as pd
import streamlit as st

from plot_data import plotly_plot


def main():
    st.markdown("<h2 style='text-align: left; color: black; font-family:Arial;font-size:2.25rem;'>Datenanalyse</h2>",  unsafe_allow_html=True)

    uploaded_file = st.file_uploader("CSV hochladen", type=["csv"])

    if uploaded_file is not None:
            try:
                df = pd.read_csv(uploaded_file)
            except pd.errors.EmptyDataError:
                st.error("Fehler: Leere CSV Datei")
            except Exception as e:
                st.error(f"Error: {str(e)}")


    tab1, tab2 = st.tabs(["Import", "Analyse"])

    with tab1:

        if uploaded_file is not None:

            mittelwert = st.slider("Gleitender Mittelwert", 0, 1000, 0, 10)

            time_column = st.selectbox("Zeit auswählen", df.columns, index=0)
            data_column = st.selectbox("Daten auswählen", df.columns)     

            if time_column == data_column:
                 st.write("Zeit und Daten können nicht gleich sein")


            fig = plotly_plot(df, time_column, data_column, mittelwert)
            fig.update_layout(width = 1600, height = 600)
            st.plotly_chart(fig)


    with tab2:
         pass

if __name__ == "__main__":
    main()