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

int values are being stringified with floating points #793

Closed
andyndang opened this issue Sep 9, 2022 · 8 comments
Closed

int values are being stringified with floating points #793

andyndang opened this issue Sep 9, 2022 · 8 comments
Assignees
Labels
bug Something isn't working stale 💤

Comments

@andyndang
Copy link
Contributor

andyndang commented Sep 9, 2022

Description

import pandas as pd

df = pd.DataFrame({'int-only': [1, 1, 1]})

print(why.log(df).view().to_pandas()["frequent_items/frequent_strings"])

Expected to see only "1", not "1.0000"

The actual output:

column
int-only    [FrequentItem(value='1.000000', est=3, upper=3...
Name: frequent_items/frequent_strings, dtype: object

Related

I suspect somehow the Python code is passing the numpy array as float type, but I'm not sure

@andyndang
Copy link
Contributor Author

Weird. Calling the sketching lib with a numpy thing works:

    import numpy as np  # type: ignore
    import whylogs_sketching as ds  # type: ignore
    freq = ds.frequent_strings_sketch(12)
    freq.update_np(np.array([1, 1, 1]))

@andyndang
Copy link
Contributor Author

One thing is the arr.dtype in metrics.py:445 is that it shows up as int64

@andyndang
Copy link
Contributor Author

np.array([1,1, 1]).dtype is also int64

@andyndang
Copy link
Contributor Author

Ohhh so we're passing as Pandas Series in whylogs, and somehow it turns into float in numpy conversion

@andyndang
Copy link
Contributor Author

This PR will fix it: #794

@andyndang andyndang self-assigned this Sep 9, 2022
@andyndang andyndang added the bug Something isn't working label Sep 9, 2022
@jamie256
Copy link
Contributor

jamie256 commented Sep 9, 2022

Nice root cause analysis, thanks for the details and investigation Andy!

@github-actions
Copy link
Contributor

This issue is stale. Remove stale label or it will be closed tomorrow.

@andyndang
Copy link
Contributor Author

Fixed by #794

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale 💤
Projects
None yet
Development

No branches or pull requests

2 participants