File size: 1,150 Bytes
e93c297
 
 
 
 
 
 
 
 
 
 
 
 
 
7b5e845
e93c297
 
 
 
 
7b5e845
 
 
f464d08
 
e93c297
868a38a
 
 
 
7b5e845
 
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
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)}")

    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)     

        try:
            fig = plotly_plot(df, time_column, data_column, mittelwert)
            fig.update_layout(width = 1600, height = 600)
            st.plotly_chart(fig)
        except Exception as e:
            st.error(f"Error: {str(e)}")


if __name__ == "__main__":
    main()