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
# Your code hereimportpandasaspdimportnumpyasnpimportmatplotlib.pyplotaspltda=np.arange(12).reshape(6,2)
df=pd.DataFrame(da,columns=list('ab'))
fig, ax=plt.subplots()
df[['a']].plot(x=df['b'],ax=ax)
plt.show()
Problem description
these test code run ok on pandas version 0.20.0 ,but error on pandas version is 0.25.1.
the error info is:
KeyError: "None of [Int64Index([1, 3, 5, 7, 9, 11], dtype='int64')] are in the [columns]"
the detail trace info are:
File "E:/pytest/dfplot1.py", line 7, in
df[['a']].plot(x=df['b'],ax=ax)
File "C:\Program Files\Python37\lib\site-packages\pandas\plotting_core.py", line 759, in call
elif not isinstance(data[x], ABCSeries):
File "C:\Program Files\Python37\lib\site-packages\pandas\core\frame.py", line 2986, in getitem
indexer = self.loc._convert_to_indexer(key, axis=1, raise_missing=True)
File "C:\Program Files\Python37\lib\site-packages\pandas\core\indexing.py", line 1285, in _convert_to_indexer
return self._get_listlike_indexer(obj, axis, **kwargs)[1]
File "C:\Program Files\Python37\lib\site-packages\pandas\core\indexing.py", line 1092, in _get_listlike_indexer
keyarr, indexer, o._get_axis_number(axis), raise_missing=raise_missing
File "C:\Program Files\Python37\lib\site-packages\pandas\core\indexing.py", line 1177, in _validate_read_indexer
key=key, axis=self.obj._get_axis_name(axis)
KeyError: "None of [Int64Index([1, 3, 5, 7, 9, 11], dtype='int64')] are in the [columns]"
[this should explain why the current behaviour is a problem and why the expected output is a better solution.]
Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!
Note: Many problems can be resolved by simply upgrading pandas to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if master addresses this issue, but that is not necessary.
For documentation-related issues, you can check the latest versions of the docs on master here:
Code Sample, a copy-pastable example if possible
Problem description
these test code run ok on pandas version 0.20.0 ,but error on pandas version is 0.25.1.
the error info is:
KeyError: "None of [Int64Index([1, 3, 5, 7, 9, 11], dtype='int64')] are in the [columns]"
the detail trace info are:
File "E:/pytest/dfplot1.py", line 7, in
df[['a']].plot(x=df['b'],ax=ax)
File "C:\Program Files\Python37\lib\site-packages\pandas\plotting_core.py", line 759, in call
elif not isinstance(data[x], ABCSeries):
File "C:\Program Files\Python37\lib\site-packages\pandas\core\frame.py", line 2986, in getitem
indexer = self.loc._convert_to_indexer(key, axis=1, raise_missing=True)
File "C:\Program Files\Python37\lib\site-packages\pandas\core\indexing.py", line 1285, in _convert_to_indexer
return self._get_listlike_indexer(obj, axis, **kwargs)[1]
File "C:\Program Files\Python37\lib\site-packages\pandas\core\indexing.py", line 1092, in _get_listlike_indexer
keyarr, indexer, o._get_axis_number(axis), raise_missing=raise_missing
File "C:\Program Files\Python37\lib\site-packages\pandas\core\indexing.py", line 1177, in _validate_read_indexer
key=key, axis=self.obj._get_axis_name(axis)
KeyError: "None of [Int64Index([1, 3, 5, 7, 9, 11], dtype='int64')] are in the [columns]"
[this should explain why the current behaviour is a problem and why the expected output is a better solution.]
Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!
Note: Many problems can be resolved by simply upgrading
pandas
to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check ifmaster
addresses this issue, but that is not necessary.For documentation-related issues, you can check the latest versions of the docs on
master
here:https://pandas-docs.github.io/pandas-docs-travis/
If the issue has not been resolved there, go ahead and file it in the issue tracker.
Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Windows
OS-release : 7
machine : AMD64
processor : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.25.1
numpy : 1.17.2
pytz : 2019.2
dateutil : 2.8.0
pip : 19.0.3
setuptools : 40.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : 0.9.3
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : 1.3.8
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: