You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/src/pandas/pandas/plotting/_core.py", line 604, in boxplot_frame_groupbyreturn plot_backend.boxplot_frame_groupby(
File "/src/pandas/pandas/plotting/_matplotlib/boxplot.py", line 485, in boxplot_frame_groupby
ret = df.boxplot(
File "/src/pandas/pandas/plotting/_core.py", line 511, in boxplot_framereturn plot_backend.boxplot_frame(
File "/Users/ian/src/pandas/pandas/plotting/_matplotlib/boxplot.py", line 414, in boxplot_frame
ax = boxplot(
File "/src/pandas/pandas/plotting/_matplotlib/boxplot.py", line 391, in boxplot
data = data[columns]
File "/src/pandas/pandas/core/frame.py", line 3504, in __getitem__
indexer =self.columns._get_indexer_strict(key, "columns")[1]
File "/src/pandas/pandas/core/indexes/multi.py", line 2559, in _get_indexer_strictreturnsuper()._get_indexer_strict(key, axis_name)
File "/src/pandas/pandas/core/indexes/base.py", line 5510, in _get_indexer_strictself._raise_if_missing(keyarr, indexer, axis_name)
File "/src/pandas/pandas/core/indexes/multi.py", line 2579, in _raise_if_missingreturnsuper()._raise_if_missing(key, indexer, axis_name)
File "/src/pandas/pandas/core/indexes/base.py", line 5570, in _raise_if_missingraiseKeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [MultiIndex([('a', 'v'),\n ('b', 'v'),\n ('c', 'v')],\n )] are in the [columns]"
@jreback has raised the issue that this may not necessarily be desired behavior. Based on the documentation, boxplot isn’t supported on object columns, and it should be up to the user to coerce them to numbers if that’s what they want.
If that is the case, it might make sense to check for this somewhere, explicitly raise an error indicating that this is not a supported use of boxplot, and suggest that the user use to_numeric if they have numeric data that is mistakenly set to type object. That seems easier to understand than the cryptic error above.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
results in the following error:
Issue Description
This might be related to #16748
Expected Behavior
The same as:
Installed Versions
pandas : 1.4.0.dev0+634.ga951998314
numpy : 1.20.3
pytz : 2021.1
dateutil : 2.8.2
pip : 21.2.4
setuptools : 52.0.0.post20210125
Cython : 0.29.24
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: