From 575417946fcd6d1ee89c284e6a979a9ec816b576 Mon Sep 17 00:00:00 2001 From: Diana Omelianchyk Date: Tue, 7 Jan 2025 13:10:35 -0500 Subject: [PATCH] empty dataframy bug fix --- sdv/data_processing/data_processor.py | 2 ++ sdv/single_table/base.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sdv/data_processing/data_processor.py b/sdv/data_processing/data_processor.py index 58f95c780..db9b08efc 100644 --- a/sdv/data_processing/data_processor.py +++ b/sdv/data_processing/data_processor.py @@ -965,6 +965,8 @@ def filter_valid(self, data): Table containing only the valid rows. """ for constraint in self._constraints: + if data.empty: + return data data = constraint.filter_valid(data) return data diff --git a/sdv/single_table/base.py b/sdv/single_table/base.py index d8925e2b5..2470c56d6 100644 --- a/sdv/single_table/base.py +++ b/sdv/single_table/base.py @@ -637,6 +637,8 @@ def _filter_conditions(sampled, conditions, float_rtol): pandas.DataFrame: Rows from the sampled data that match the conditions. """ + if sampled.empty: + return sampled for column, value in conditions.items(): column_values = sampled[column] if column_values.dtype.kind == 'f':