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

Unexpected inplace dtype conversion #43

Open
FabianHofmann opened this issue Aug 9, 2021 · 2 comments
Open

Unexpected inplace dtype conversion #43

FabianHofmann opened this issue Aug 9, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@FabianHofmann
Copy link

The function dedupe_dataframe changes the dtypes of the input dataframe (e.g. float to string). One would rather expect this functions to not change the input arguments. One could prevent this by modifying a copy of the original dataframe.

@Lyonk71 Lyonk71 added the bug Something isn't working label Aug 10, 2021
@Lyonk71
Copy link
Owner

Lyonk71 commented Aug 10, 2021

Thanks for the comment. Implementing your suggestion would provide more abstraction than is my intention. In fact, I actually dislike that the program currently abstracts the pre-processing step (which converts float to string). In the future, I may separate out the pre-processing step to make that conversion process explicit. What do you think?

IIWY, I'd generate a hash ID for each record prior to running pandas-dedupe, then join accordingly afterwards - it should only be a few lines of code. Let me know if you need more guidance on that.

@FabianHofmann
Copy link
Author

Thanks for the answer @Lyonk71, I rather thought of a copy of all columns needed for clustering (and keep the pre-processing steps hidden), like

    cols = [c if isinstance(c, str) else c[0] for c in field_properties]
    data = df[cols]

inserted here

and then use data instead of df in the subsequent code. Any downside I oversaw? If you want I could make a PR

@FabianHofmann FabianHofmann mentioned this issue Dec 1, 2021
genericallyterrible added a commit to genericallyterrible/pandas-dedupe that referenced this issue Jun 7, 2023
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
Development

Successfully merging a pull request may close this issue.

2 participants