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

Creating SeriesReport throws TypeError when pd.Series type is bool #19

Closed
ray310 opened this issue Jul 2, 2024 · 0 comments
Closed
Assignees
Labels
0.0.3 bug Something isn't working

Comments

@ray310
Copy link
Owner

ray310 commented Jul 2, 2024

Describe the bug
Creating a SeriesReport from a pd.Series of type bool throws:

TypeError: numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.

Error originates here when distribution_stats function tries to get quantile of boolean series.

To Reproduce

import pandas as pd
import pandahelper as ph

data = {
    "user_id": [1, 2, 3, 4, 4],
    "transaction": ["purchase", "return", "purchase", "exchange", "exchange"],
    "amount": [100.00, None, 1400.00, 85.12, 85.12],
    "survey": [None, None, None, "online", "online"],
    "flag": [False, True, False, True, True]
}
df = pd.DataFrame(data)
series_profile = ph.SeriesProfile(df["flag"])

Expected behavior
SeriesProfile of a Boolean series should provide a sensible summary with number of nulls, and counts / percentages of True and False.

@ray310 ray310 added bug Something isn't working 0.0.3 labels Jul 2, 2024
@ray310 ray310 self-assigned this Jul 2, 2024
ray310 added a commit that referenced this issue Jul 2, 2024
ray310 added a commit that referenced this issue Jul 2, 2024
ray310 added a commit that referenced this issue Jul 6, 2024
    Addresses gh-19 and provides different summary statistics based on data type.
@ray310 ray310 closed this as completed Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.0.3 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant