-
-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Series index names not assigned to None when mismatching during addition #20507
Comments
actually what |
@jreback So why not have |
because you are returning both objects |
is there anything left to do here? |
I think we need to decide what behavior we want when doing an arithmetic operation on two series with different names, in the case where the indices are aligned, or not aligned. See [15] and [16] in the original example. |
IIUC the issue isn't |
Yes, that is correct. |
Code Sample, a copy-pastable example if possible
Problem description
It's not clear if this is a bug or a feature, and if the latter, then the behavior should be documented.
In the first example
s1.align(s2)
, the two series have the same index values, but the names of the respective index for each series is different. In this case,s1.align(s2)
returns the two series, preserving the names of the respective indexes.In the second example,
s3.align(s2)
, the two series have different index values, and the names of the respective index for each series is different. In this case,s3.align(s2)
returns the two series, but the names of the indices have disappeared.In the third example,
s3.align(s4)
, the two series have different index values, and the names of the respective index for each series is the same. In this case,s3.align(s4)
returns the two series, and the names of each index are the same name.So in the first two cases, the names are different, but in the first case, the names are preserved, while in the second case, the names are lost.
In the last two cases, the index values are the different, but the names are preserved if they are the same, otherwise they are lost.
Finally, the last 2 examples, involving addition show some asymmetries due to this issue with
Series.align()
with respect to name handling when adding two series with different names. In this case,s1+s2
ands2+s1
have indices with different names, which seems a bit odd.Expected Output
This is not clear to me. Either
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: 6c1ab7f
python: 3.6.4.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.0.dev0+685.g6c1ab7f2c
pytest: 3.3.2
pip: 9.0.1
setuptools: 38.4.0
Cython: 0.27.3
numpy: 1.14.0
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.6
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.2
openpyxl: 2.4.10
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.1
pymysql: 0.7.11.None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: