arnaudmiribel/streamlit-extras

๐Ÿ› [BUG] - dataframe sort by date column seems broken

Opened this issue ยท 1 comments

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

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