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

Bug: Missing value conversion #96

Open
ValterH opened this issue Jan 26, 2025 · 0 comments · May be fixed by #97
Open

Bug: Missing value conversion #96

ValterH opened this issue Jan 26, 2025 · 0 comments · May be fixed by #97

Comments

@ValterH
Copy link

ValterH commented Jan 26, 2025

Description:

Converting missing values raises an error, which causes sampling to fail.

Trace:

 File ".../realtabformer/rtf_sampler.py", line 332, in _recover_data_values
    group_series.str.replace("[^0-9]", "", regex=True)
  File ".../pandas/core/series.py", line 4397, in map
    new_values = self._map_values(arg, na_action=na_action)
  File ".../pandas/core/base.py", line 924, in _map_values
    new_values = map_f(values, mapper)
  File "pandas/_libs/lib.pyx", line 2834, in pandas._libs.lib.map_infer
  File ".../realtabformer/rtf_sampler.py", line 333, in <lambda>
    .map(lambda x: int(x) if x else None)
ValueError: cannot convert float NaN to integer

Link and Suggested Solution:

.map(lambda x: int(x) if x else None)

Replace map(lambda x: int(x) if x else None) with map(lambda x: int(x) if x==x else None)

Environment:

  • Python version: 3.8.20
  • Pandas version: 2.0.3
  • RealTabFormer version: 0.2.2
  • Platform: Linux
@ValterH ValterH linked a pull request Jan 26, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant