BUG: Arithmetic operators in 1.5 throw RecursionError when dataframes have a mix of str and string typed levels #49769
Labels
Bug
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
Numeric Operations
Arithmetic, Comparison, and Logical operations
Regression
Functionality that used to work in a prior pandas version
Milestone
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
Issue Description
If one has identically structured data frames where one has some column names as type str and the other of type string, doing any arithmentic operations using operators (confirmed with +, -, /, *) results in the infinite recursion: RecursionError: maximum recursion depth exceeded while calling a Python object. This did not happen with 1.4.X.
The recursion happens in frame_arith_method_with_reindex.py line 366, from what i can see.
Expected Behavior
Expected behaviour is that the operators would work, and in the above example to return a dataframe with all zeros.
Installed Versions
INSTALLED VERSIONS
commit : 91111fd
python : 3.9.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : English_United Kingdom.1252
pandas : 1.5.1
numpy : 1.23.4
pytz : 2022.6
dateutil : 2.8.2
setuptools : 58.1.0
pip : 22.3.1
Cython : None
pytest : 7.2.0
hypothesis : None
sphinx : 4.5.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.5.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.5
brotli : None
fastparquet : 0.8.3
fsspec : 2022.11.0
gcsfs : None
matplotlib : None
numba : None
numexpr : 2.8.4
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 10.0.0
pyreadstat : None
pyxlsb : 1.0.10
s3fs : None
scipy : 1.9.1
snappy : None
sqlalchemy : None
tables : 3.7.0
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: