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 "/Users/wenjun/miniconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-9916dba4e800>", line 1, in <module>
pd.concat([df.iloc[:6, 3:5], df.iloc[:6, 6:8]], axis=1).shift(periods=2, axis=1, freq=None, fill_value=0)
File "/Users/wenjun/miniconda3/lib/python3.8/site-packages/pandas/core/frame.py", line 5313, in shift
return super().shift(
File "/Users/wenjun/miniconda3/lib/python3.8/site-packages/pandas/core/generic.py", line 9179, in shift
new_data = self._mgr.shift(
File "/Users/wenjun/miniconda3/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 393, in shift
result = self.reindex_indexer(
File "/Users/wenjun/miniconda3/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 669, in reindex_indexer
new_blocks = self._slice_take_blocks_ax0(
File "/Users/wenjun/miniconda3/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 714, in _slice_take_blocks_ax0
sl_type, slobj, sllen = _preprocess_slice_or_indexer(
File "/Users/wenjun/miniconda3/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 2033, in _preprocess_slice_or_indexer
raise TypeError(type(slice_or_indexer), dtype)
TypeError: (<class 'list'>, None)
Problem description
shift should work without exception. When df._data._consolidate_inplace() is called before shift, it works well. Thus consolidation might be missing, just like #35488.
wjsi
changed the title
BUG: TypeError when shifting DataFrame created by concatenation of slices
BUG: TypeError when shifting DataFrame created by concatenation of slices and fills with 0
Jul 9, 2021
wjsi
changed the title
BUG: TypeError when shifting DataFrame created by concatenation of slices and fills with 0
BUG: TypeError when shifting DataFrame created by concatenation of slices and fills with values
Jul 9, 2021
When fill_value is not specified, things work well, but when fill_value is filled, even if the value is None, the error emerges. Same thing happen when testing with latest master branch.
Any one please take a look at this issue? Problem still exists in current master branch (9c0a1ebec6028d98e47c5664fd2cad173bfd9c21). I reopened the PR as int-fill for axis=1 is not implemented and is expected to fail.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
shift
should work without exception. Whendf._data._consolidate_inplace()
is called before shift, it works well. Thus consolidation might be missing, just like #35488.Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : f00ed8f
python : 3.8.5.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Thu May 6 00:48:39 PDT 2021; root:xnu-6153.141.33~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : zh_CN.UTF-8
pandas : 1.3.0
numpy : 1.18.5
pytz : 2021.1
dateutil : 2.8.1
pip : 20.2.2
setuptools : 49.6.0.post20200814
Cython : 0.29.23
pytest : 6.2.2
hypothesis : 6.3.0
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.17.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : 0.4.2
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.1
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 4.0.0
pyxlsb : None
s3fs : None
scipy : 1.6.0
sqlalchemy : 1.3.18
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.53.0
The text was updated successfully, but these errors were encountered: