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

FloatFormatter does not round the data correctly for integer columns when using _set_fitted_parameters #874

Closed
R-Palazzo opened this issue Aug 26, 2024 · 0 comments · Fixed by #875
Assignees
Labels
bug Something isn't working
Milestone

Comments

@R-Palazzo
Copy link
Contributor

Environment Details

  • RDT version: 1.12.3

Error Description

We can't currently set the rounding_digits attribute of the FloatFormatter to 0 with _set_fitted_parameters. It seems to be because of the following line:

if rounding_digits:

Steps to reproduce

In the code below the reverse_transformed_data will not be rounded while rounding_digits=0

import pandas as pd
import numpy as np
from rdt.transformers import FloatFormatter, NullTransformer

data = pd.DataFrame({
    'col 1': 100 * np.random.random(10),
})
transformer = FloatFormatter()
transformer._set_fitted_parameters(
    column_name='col 1',
    null_transformer=NullTransformer(),
    rounding_digits=0,
    dtype='float',
)

reverse_transformed_data = transformer.reverse_transform(data)
reverse_transformed_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant