arnaudmiribel / streamlit-extras

Discover, try, install and share Streamlit re-usable bits we call "extras"!
https://extras.streamlit.app
Apache License 2.0
715 stars 123 forks source link

🐛 [BUG] - dataframe sort by date column seems broken #162

Open yulevern opened 1 year ago

yulevern commented 1 year ago

Description

Hi, I passed a dataframe into dataframe_explorer, in the UI when I try to sort by date columns it raise a warning which indicates a problem in the source code, and in the UI the table is not sorted correctly for the date columns.

    filtered_df = dataframe_explorer(df, case=False)
    col_config={
        "DATE_1": st.column_config.TimeColumn(format="YYYY-MM-DD"),
        "DATE_2": st.column_config.TimeColumn(format="YYYY-MM-DD")
    }
    st.dataframe(filtered_df, use_container_width=True, column_config=col_config)
lib/python3.10/site-packages/streamlit_extras/dataframe_explorer/__init__.py:34: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  df[col] = pd.to_datetime(df[col])
image

Version of streamlit

1.25.0

Version of streamlit-extras

0.3.0

arnaudmiribel commented 4 weeks ago

@yulevern would you mind sharing a reproducible code example with sample data? I can't reproduce your issue. Thanks!