Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NotImplementedError when using FloatFormatter with numerical data types during fit due to PyArrow #887

Merged
merged 8 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ test = [
'rundoc>=0.4.3,<0.5',
'pytest-subtests>=0.5,<1.0',
'pytest-runner >= 2.11.1',
'pyarrow >= 17.0.0',
'tomli>=2.0.0,<3',
]
dev = [
Expand Down
2 changes: 1 addition & 1 deletion rdt/transformers/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _raise_out_of_bounds_error(self, value, name, bound_type, min_bound, max_bou

def _validate_values_within_bounds(self, data):
if not self.computer_representation.startswith('Float'):
fractions = data[~data.isna() & data % 1 != 0]
fractions = data[~data.isna() & (data != (data // 1))]
fealho marked this conversation as resolved.
Show resolved Hide resolved
if not fractions.empty:
raise ValueError(
f"The column '{data.name}' contains float values {fractions.tolist()}. "
Expand Down
2 changes: 1 addition & 1 deletion rdt/transformers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def learn_rounding_digits(data):
return None

# Doesn't contain decimal digits
if ((roundable_data % 1) == 0).all():
if (roundable_data == roundable_data.astype(int)).all():
return 0

# Try to round to fewer digits
Expand Down
Loading