-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
-
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
import pandas as pd
df = pd.DataFrame([0,1,2]).append(pd.DataFrame([3,4,5]))
df.columns = ['a']
print(df - df.a)
Problem description
Why we can not to do binary operations when we work with DataFrame
and Series
(dataframe has 1 columns, len(df.index)==len(series.index)) with duplicated indexes? If left and right operands have the same type (
DataFrame/DataFrame` for example) it works.
Expected Output
0 0
1 0
2 0
0 0
1 0
2 0
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 67a3d42
python : 3.8.3.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-50-generic
Version : #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US
LOCALE : en_US.ISO8859-1
pandas : 1.1.4
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.4.0.post20200518
Cython : None
pytest : 6.1.1
hypothesis : None
sphinx : None
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : 4.5.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : None
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : 0.8.3
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : 0.14.0
pyarrow : 1.0.0
pytables : None
pyxlsb : None
s3fs : 0.5.1
scipy : 1.5.2
sqlalchemy : 1.3.19
tables : 3.6.1
tabulate : None
xarray : 0.16.1
xlrd : 1.2.0
xlwt : None
numba : None