Skip to content

Logical comparison operators and mathematical operators are applied inconsistently for series. #13587

Closed
@RobertasA

Description

@RobertasA

In series all logical operators are by position (iloc) while all mathematical operators are by location (loc).
This is probably similar to #4581.

e.g.
import pandas as pd
a = pd.Series([1, 4], index=[0, 1])
b = pd.Series([3, 7], index=[1, 0])

a>b

Gives

0 False
1 False
dtype: bool

But

a - b

gives

0 -6
1 1
dtype: int64

output of pd.show_versions()

`

pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8

pandas: 0.18.1
nose: None
pip: 1.5.6
setuptools: 3.6
Cython: None
numpy: 1.11.1
scipy: None
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions