From cf00519376609c3a3fad5b66eacf7f3c85e9a333 Mon Sep 17 00:00:00 2001 From: Nitin Bansal Date: Mon, 16 Dec 2024 23:05:21 +0530 Subject: [PATCH] fix casting with empty dataframes --- fennel/CHANGELOG.md | 3 +++ fennel/testing/executor.py | 2 +- fennel/testing/test_utils.py | 4 +++- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fennel/CHANGELOG.md b/fennel/CHANGELOG.md index 99911785..66cb5034 100644 --- a/fennel/CHANGELOG.md +++ b/fennel/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [1.5.62] - 2024-12-16 +- Fix casting for empty dataframes. + ## [1.5.61] - 2024-12-12 - Add appropriate warnings for aggregations on top of keyed datasets. diff --git a/fennel/testing/executor.py b/fennel/testing/executor.py index b9527b4e..f3d1ea09 100644 --- a/fennel/testing/executor.py +++ b/fennel/testing/executor.py @@ -334,7 +334,7 @@ def join_aggregated_dataset( for col in key_dfs.columns: # If any of the columns is a dictionary, convert it to a frozen dict - if key_dfs[col].apply(lambda x: isinstance(x, dict)).any(): + if any([isinstance(x, dict) for x in key_dfs[col].tolist()]): key_dfs[col] = key_dfs[col].apply(lambda x: frozendict(x)) # Find the values for all columns as of the timestamp in key_dfs diff --git a/fennel/testing/test_utils.py b/fennel/testing/test_utils.py index 2d7d35a8..a9db220b 100644 --- a/fennel/testing/test_utils.py +++ b/fennel/testing/test_utils.py @@ -381,7 +381,9 @@ def add_deletes( last_index_for_key[key] = i # Add the delete timestamp as a hidden column to the dataframe - sorted_df[FENNEL_DELETE_TIMESTAMP] = delete_timestamps + sorted_df[FENNEL_DELETE_TIMESTAMP] = pd.Series( + delete_timestamps, dtype=pd.ArrowDtype(pa.timestamp("ns", "UTC")) + ) if len(rows_to_delete) > 0: # Drop the rows that are marked for deletion diff --git a/pyproject.toml b/pyproject.toml index 2efe765f..ad0511f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fennel-ai" -version = "1.5.61" +version = "1.5.62" description = "The modern realtime feature engineering platform" authors = ["Fennel AI "] packages = [{ include = "fennel" }]