-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: issue#915, Error for large integers in Series #1233
Open
Sohaib90
wants to merge
10
commits into
ydataai:develop
Choose a base branch
from
Sohaib90:issue915
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0fabbf7
fix: issue#915 error for large integers
Sohaib90 56e102a
fix: issue#915 added histogram_bin_egdes with max_bins
Sohaib90 21d8042
fix: issue#915 lint issues
Sohaib90 3da095e
Merge branch 'develop' into issue915
Sohaib90 628493e
Merge branch 'develop' into issue915
Sohaib90 78cfb30
fix: issue#915 flake8 errors
Sohaib90 e689665
fix: issue#915 bin args
Sohaib90 6a5409e
fix: issue#915 rename var bin_args
Sohaib90 0f66735
Merge branch 'develop' into issue915
Sohaib90 01c2677
Merge branch 'develop' into issue915
Sohaib90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
Test for issue 915: | ||
https://github.com/ydataai/pandas-profiling/issues/915 | ||
|
||
Error for series with large integers. | ||
""" | ||
import fnmatch | ||
|
||
import pandas as pd | ||
|
||
from pandas_profiling import ProfileReport | ||
|
||
|
||
def test_issue915(): | ||
df = pd.DataFrame({"col": pd.Series([716277643516076032 + i for i in range(100)])}) | ||
df_profile = ProfileReport(df) | ||
|
||
def test_with_value(n_extreme_obs): | ||
"""Generate HTML and validate the tabs contain the proper tab titles.""" | ||
df_profile.config.n_extreme_obs = n_extreme_obs | ||
df_profile.invalidate_cache() | ||
|
||
reg_min = f"*<a href=* aria-controls=* role=tab data-toggle=tab>Minimum {n_extreme_obs} values</a>*" | ||
reg_max = f"*<a href=* aria-controls=* role=tab data-toggle=tab>Maximum {n_extreme_obs} values</a>*" | ||
|
||
profile_html = df_profile.to_html() | ||
|
||
assert fnmatch.fnmatch(profile_html, reg_min) | ||
assert fnmatch.fnmatch(profile_html, reg_max) | ||
|
||
test_with_value(5) | ||
test_with_value(100) | ||
test_with_value(120) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting solution, but still seems to behave a bit weirdly with big numbers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it is still not evenly distributed like it should be for smaller numbers. What do you propose here? Leaving
np.histogram_bin_edges
raises an error for larger numbers. Is it better to raise error than have weird behavior?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking from a user's perspective, for me is better to have an error being raised than an incorrect plot. If I know that there was a problem with the large integers I can preprocess that column and run again, but an incorrect result may lead me to an incorrect interpretation of my data distribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is what I was thinking as well. I think I should make the changes so that it leads to raising an error rather than making an incorrect plot, right?
Also there is a check
Codacy Static Code Analysis
that is failing. I think that is a new one