File size: 1,485 Bytes
3f8b341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import pandas as pd
import streamlit as st
from pyxlsb import open_workbook

st.title("📊 Parameters distribution Analyzer")

uploaded_file = st.file_uploader("Upload an .xlsb Dump file", type="xlsb")

if uploaded_file:
    # Get sheet names
    with open_workbook(uploaded_file) as wb:
        sheet_names = wb.sheets

    # Dropdown for Object Class (sheet)
    object_class = st.selectbox("Select Object Class (Sheet)", sheet_names)

    if object_class:
        # Read the selected sheet, skip first row
        df: pd.DataFrame = pd.read_excel(
            uploaded_file, sheet_name=object_class, skiprows=[0], engine="calamine"
        )

        if df.empty:
            st.warning("The selected sheet is empty or couldn't be read.")
        else:

            parameters = st.multiselect("Select Parameter(s)", df.columns)

            if parameters:
                for param in parameters:
                    st.markdown(f"---\n### 🔹 {param}")
                    col1, col2 = st.columns(2)

                    # Distribution table
                    with col1:
                        dist = df[param].value_counts(dropna=False).reset_index()
                        dist.columns = [param, "Count"]
                        st.dataframe(dist, use_container_width=True)

                    # Bar chart
                    with col2:
                        chart_data = dist.set_index(param)
                        st.bar_chart(chart_data, use_container_width=True)