Skip to content

Plotting Int64 columns with nulled integers (NAType) fails #32073 #32387

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

Closed
wants to merge 28 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
05ab972
BUG: fixes unhandled NAType when plotting (#32073)
jeandersonbc Feb 28, 2020
c7756b1
BUG: fixes unhandled NAType when plotting (#32073)
jeandersonbc Feb 28, 2020
0e738b0
Fixed bad formatting
jeandersonbc Mar 1, 2020
26d3297
REF: collect+parametrize reorder_levels tests (#32373)
jbrockmendel Mar 2, 2020
0ff6b96
TST: Allow definition of `pd.CategoricalDtype` with a specific `categ…
rushabh-v Mar 2, 2020
64f76e9
TYP: annotations for internals, set_axis (#32376)
jbrockmendel Mar 2, 2020
70b840b
misplaced DataFrame.join test (#32375)
jbrockmendel Mar 2, 2020
8262397
DOC: Fixed ES01, PR07, SA04 error in pandas.core.groupby.DataFrameGro…
Iqrar99 Mar 2, 2020
d2d14b7
BUG: Pickle NA objects (#32104)
TomAugspurger Mar 2, 2020
ba7895e
DOC: Fix SA04 errors in docstrings #28792 (#32182)
AdrianMastronardi Mar 3, 2020
f2f8605
CLN: remove _igetitem_cache (#32319)
jbrockmendel Mar 3, 2020
6a48be6
Avoid unnecessary values_from_object (#32398)
jbrockmendel Mar 3, 2020
bc4c189
ENH: infer freq in timedelta_range (#32377)
jbrockmendel Mar 3, 2020
6023860
BUG: 2D DTA/TDA arithmetic with object-dtype (#32185)
jbrockmendel Mar 3, 2020
66422c4
TST: broken off from #32187 (#32258)
jbrockmendel Mar 3, 2020
7210810
REF: simplify PeriodIndex._shallow_copy (#32280)
jbrockmendel Mar 3, 2020
e262a71
CLN: setitem_with_indexer cleanups (#32341)
jbrockmendel Mar 3, 2020
143faa0
BUG: None / Timedelta incorrectly returning NaT (#32340)
jbrockmendel Mar 3, 2020
d2413f9
TST: Using more fixtures in of tests/base/test_ops.py (#32313)
SaturnFromTitan Mar 3, 2020
0a7ebfd
CLN: remove unused values from interpolate call (#32400)
jbrockmendel Mar 3, 2020
3f9b4e8
CLN: some code cleanups to pandas/_libs/missing.pyx (#32367)
ShaharNaveh Mar 3, 2020
0d41a23
BUG: fixes bug when using sep=None and comment keyword for read_csv (…
s-scherrer Mar 3, 2020
a57de43
Don't create _join_functions (#32336)
dsaxton Mar 3, 2020
5759ad9
API: replace() should raise an exception if invalid argument is given…
a-y-khan Mar 3, 2020
1c5b03f
BUG: Fix __ne__ comparison for Categorical (#32304)
dsaxton Mar 3, 2020
b03a910
CLN: clean-up show_versions and consistently use null for json output…
simonjayhawkins Mar 3, 2020
1973ddb
Add missing newline (#32404)
Mar 3, 2020
9f71755
Added simple test case
jeandersonbc Mar 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,13 @@ def _compute_plot_data(self):
# np.ndarray before plot.
numeric_data = numeric_data.copy()
for col in numeric_data:
numeric_data[col] = np.asarray(numeric_data[col])

# GH32073: cast to float if values contain nulled integers
values = numeric_data[col]
if values.isna().any().all():
values = values.astype(float)

Comment on lines +419 to +421
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like date-like data can be included here, and we don't want to convert those to floats.

I think this should be restricted to

if is_integer_dtype(values.dtype):
    values = values.to_numpy(dtype="float", na_value=np.nan)

numeric_data[col] = np.asarray(values)

self.data = numeric_data

Expand Down