Skip to content

BUG: numexpr / ops with boolean and conversion #7192

Closed
@jreback

Description

@jreback

these cases should give the same results. Somehow the ops order is being reversed or something with numexpr.

numpy 1.8.1, numexpr 2.4, pandas 0.14rc1
Can be worked around like:

In [39]: df = DataFrame(dict(A=np.random.randn(25000)))

In [40]: df.iloc[0:5] = np.nan

In [41]: (1-np.isnan(df)).iloc[0:25]
Out[41]: 
       A
0      0
1      0
2      0
3      0
4      0
5     -1
6     -1
7     -1
8     -1
9     -1
10    -1
11    -1
12    -1
13    -1
14    -1
15    -1
16    -1
17    -1
18    -1
19    -1
20    -1
21    -1
22    -1
23    -1
24    -1
25    -1
In [43]: df = DataFrame(dict(A=np.random.randn(25)))

In [44]: df.iloc[0:5] = np.nan

In [45]: (1-np.isnan(df)).iloc[0:25] 
Out[45]: 
    A
0   0
1   0
2   0
3   0
4   0
5   1
6   1
7   1
8   1
9   1
10  1
11  1
12  1
13  1
14  1
15  1
16  1
17  1
18  1
19  1
20  1
21  1
22  1
23  1
24  1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions