-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: Exception in pd.plotting #28350
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
Changes from all commits
5705129
006795f
ca03606
a17a08c
53b53f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
from pandas.util._decorators import cache_readonly | ||
|
||
from pandas.core.dtypes.common import ( | ||
is_float, | ||
is_hashable, | ||
is_integer, | ||
is_iterator, | ||
|
@@ -1196,10 +1197,17 @@ def _post_plot_logic(self, ax, data): | |
from matplotlib.ticker import FixedLocator | ||
|
||
def get_label(i): | ||
if is_float(i) and i == int(i): | ||
i = int(i) | ||
if not is_integer(i): | ||
# TODO: is getting here indicative of a larger problem? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @datapythonista I think you've worked in this area recently, any idea if this is something to worry about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a test (or example code) that ended up here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't work in this exact part, but this seems reasonable. I'm assuming this only affects the values in the axis, and it removes the decimals if they are zero, right? I'm wondering if instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i had completely forgotten about float.is_integer; neat. But I don't think we in general have an |
||
return "" | ||
try: | ||
return pprint_thing(data.index[i]) | ||
except Exception: | ||
val = data.index[i] | ||
except IndexError: | ||
# In tests we get here with both positive and negative `i` | ||
return "" | ||
return pprint_thing(val) | ||
|
||
if self._need_to_set_index: | ||
xticks = ax.get_xticks() | ||
|
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.
This seems to be a change in behaviour? Is this tested? Or do you think this could never raise?
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.
the
len
check I dont think can raise. theself.raise_if_exceeds
seems like the kind of thing that could raise, but I think thats a matplotlib method so I'll have to dig into that to find a failing case.