Description
Pandas version checks
-
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 main branch of pandas.
Reproducible Example
import pandas as pd
series = pd.Series(
['a','b','c','d']
).astype(bytes)
series.shift(1) # will fail with RecursionError
Issue Description
pandas.Series.shift()
works for me in most cases, but not with the bytes
datatype used in the example, or with numpy equivalent types (e.g. np.dtype('aN')
).
Expected Behavior
series.shift(1)
should return [None, 'a', 'b', 'c']
in the example, probably changing the dtype
to object
to accommodate None
.
Installed Versions
INSTALLED VERSIONS
commit : 8dab54d
python : 3.10.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.19.3-051903-generic
Version : #202208211442 SMP PREEMPT_DYNAMIC Sun Aug 21 14:54:49 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.2
numpy : 1.21.5
pytz : 2022.1
dateutil : 2.8.2
setuptools : 59.6.0
pip : 23.0.1
Cython : 0.29.32
pytest : 7.1.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.8.0
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 8.4.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : None
brotli : 1.0.9
fastparquet : None
fsspec : 2022.7.1
gcsfs : None
matplotlib : 3.5.1
numba : 0.56.0
numexpr : None
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
snappy : None
sqlalchemy : 1.4.44
tables : None
tabulate : 0.8.10
xarray : None
xlrd : 1.2.0
xlwt : None
zstandard : None
tzdata : None