streamlit / streamlit

Streamlit — A faster way to build and share data apps.
https://streamlit.io
Apache License 2.0
34.43k stars 2.98k forks source link

Allow multiple time-series for chart dataframe columns #9081

Open lucasrodes opened 1 month ago

lucasrodes commented 1 month ago

Checklist

Summary

With the help of st.column_config, one can preview time-series in dataframe cells as a LineChart, BarChart or AreaChart.

It'd be nice to show multiple time-series in the same cell.

Why?

It could be useful to have multiple time-series shown in the same cell. For instance, in my use-case, I'd like to compare two versions of the same indicator for each country. This is useful when upgrading an indicator and visually assess how close they are and if it is safe to upgrade.

At the moment, my workaround consists in showing the old and new indicator's time-series in different columns, but this is not ideal as it is harder to compare them along the x-axis (note that they share the same axis). This is shown in the image below (columns New and Old; column Error = abs(Old - New)).

image

How?

I realise that this affects multiple things:

data_df = pd.DataFrame(
    {
        "timeseries": [
            [
               [0, 4, 26, 80, 100, 40],
               [80, 20, 80, 35, 40, 100],
            ],
            [...],
            ...
        ]
    }
)

Open question: Above I'm assuming that each element in timeseries is of dimension NxM, i.e. al timeseries in the cell have same length M.

Output could be something like

image

Additional Context

No response

github-actions[bot] commented 1 month ago

To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.

Your vote helps us identify which enhancements matter most to our users.

Visits