Pandas 0.12 unexpected results when comparing dataframe to list or tuple · Issue #4576 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@ssalonen

Description

@ssalonen

It seems that when comparing DataFrame to list or tuple of values (lenght of DataFrame columns), the resulting boolean DataFrame is incorrect.

import pandas print pandas.version 0.12.0 import numpy as np print np.version 1.6.1 df=pandas.DataFrame([ [-1, 0], [1, 2] ]) df > (0, 1) 0 1 0 False False 1 False True df > [0, 1] 0 1 0 False False 1 False True

``'

Comparison with numpy array works as expected:

```python

df > np.array([0, 1]) 0 1 0 False False 1 True True ``'

Note that the comparison behaved correctly at least in pandas 0.9.0:

```python

import pandas print pandas.version 0.9.0 df=pandas.DataFrame([ [-1, 0], [1, 2] ]) df > (0, 1) 0 1 0 False False 1 True True df > [0, 1] 0 1 0 False False 1 True True ``'