diff --git a/docs/changelog.md b/docs/changelog.md index b44f47cf..7d8656fc 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,13 @@ ITables ChangeLog ================= +2.1.5-dev (2024-08-??) +------------------ + +**Fixed** +- We have adjusted the generation of the Polars sample dataframes to fix the CI ([Polars-18130](https://github.com/pola-rs/polars/issues/18130)) + + 2.1.4 (2024-07-03) ------------------ diff --git a/src/itables/sample_dfs.py b/src/itables/sample_dfs.py index 89c9b523..3b814d07 100644 --- a/src/itables/sample_dfs.py +++ b/src/itables/sample_dfs.py @@ -267,9 +267,15 @@ def get_dict_of_test_dfs(N=100, M=100, polars=False): import pyarrow as pa polars_dfs = {} - for key in test_dfs: + for key, df in test_dfs.items(): + if key == "multiindex": + # Since Polars 1.2, pl.from_pandas fails with this error: + # ValueError: Pandas dataframe contains non-unique indices and/or column names. + # Polars dataframes require unique string names for columns. + # See https://github.com/pola-rs/polars/issues/18130 + df.index = df.index.tolist() try: - polars_dfs[key] = pl.from_pandas(test_dfs[key]) + polars_dfs[key] = pl.from_pandas(df) except (pa.ArrowInvalid, ValueError): pass return polars_dfs