Spaces:
Sleeping
Sleeping
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() | |