Skip to content
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

compare two series objects ignores index #8257

Closed
longislandfarmer opened this issue Sep 12, 2014 · 5 comments
Closed

compare two series objects ignores index #8257

longislandfarmer opened this issue Sep 12, 2014 · 5 comments
Labels
Compat pandas objects compatability with Numpy or Python functions Docs

Comments

@longislandfarmer
Copy link

It seems that when comparing two Series objects, index is ignored, here is an trivial example

In [177]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.7.final.0
python-bits: 64
OS: Linux
OS-release: 3.2.0-0.bpo.4-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US

pandas: 0.14.0
nose: 1.3.0
Cython: 0.19.2
numpy: 1.8.1
scipy: 0.14.0
statsmodels: 0.5.0
IPython: 2.0.0
sphinx: 1.1.3
patsy: 0.2.1
scikits.timeseries: None
dateutil: 1.5
pytz: 2014.3
bottleneck: None
tables: 3.0.0
numexpr: 2.2.2
matplotlib: 1.3.1
openpyxl: 1.6.2
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: None
lxml: 3.2.3
bs4: 4.3.1
html5lib: None
bq: None
apiclient: None
rpy2: None
sqlalchemy: 0.8.3
pymysql: None
psycopg2: None


In [158]: a = pd.Series([100, 101, 102, 103], index=[1,2,3,4])
In [168]: b = pd.Series([102, 103, 104, 105], index=[3, 4, 5, 6])

In [170]: a
Out[170]:
1    100
2    101
3    102
4    103
dtype: int64

In [171]: b
Out[171]:
3    102
4    103
5    104
6    105
dtype: int64

In [172]: a > b
Out[172]:
1    False
2    False
3    False
4    False
dtype: bool

In [173]: a < b
Out[173]:
1    True
2    True
3    True
4    True
dtype: bool

In [174]: a == b
Out[174]:
1    False
2    False
3    False
4    False
dtype: bool

In [175]: a - b
Out[175]:
1   NaN
2   NaN
3     0
4     0
5   NaN
6   NaN
dtype: float64
@longislandfarmer longislandfarmer changed the title compare two series objects compare two series objects ignores index Sep 12, 2014
@jreback
Copy link
Contributor

jreback commented Sep 12, 2014

see discussion here: #1134

This is a feature!

@jreback jreback closed this as completed Sep 12, 2014
@longislandfarmer
Copy link
Author

Thanks for the link, can this be documented/highlighted in documentation? It's really not obvious!

@jorisvandenbossche
Copy link
Member

@jreback you say it is a feature, but we discussed it in the issue you referenced, and you also had a PR #6860 that had the intention to change this?

@jreback
Copy link
Contributor

jreback commented Sep 12, 2014

@jorisvandenbossche I know, but I don't think its easy to change this, so can't happen in 0.15.0 maybe later. let's just document for now.

@mjnicky want to take a stab at this?

@jreback jreback reopened this Sep 12, 2014
@jreback jreback added Docs Compat pandas objects compatability with Numpy or Python functions labels Sep 12, 2014
@jreback jreback added this to the 0.15.0 milestone Sep 12, 2014
@jreback jreback modified the milestones: 0.15.1, 0.15.0 Sep 23, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jorisvandenbossche
Copy link
Member

This was fixed in #13894 for 0.19.0

@jorisvandenbossche jorisvandenbossche modified the milestones: No action, Next Major Release Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Docs
Projects
None yet
Development

No branches or pull requests

3 participants