Skip to content

BUG: Pandas.DataFrame.where() behaves unexpectedly in v0.17.0 and up under Windows 8 x64 #12305

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

Closed
zk42 opened this issue Feb 12, 2016 · 2 comments
Labels
Compat pandas objects compatability with Numpy or Python functions Windows Windows OS

Comments

@zk42
Copy link

zk42 commented Feb 12, 2016

Under Windows 8 (x64), with Pandas v0.17.0 (from Anaconda) and up, Pandas.DataFrame.where() function is found to behave sporadically, sometimes returning the expected result and sometimes returning a dataframe filled with zeros.

The following code demonstrates this behavior, observed for dataframes that have larger than 361 rows and columns.

I observed that this problem does NOT exist in Pandas v0.16.2 on the same machine (Windows 8 x64, Anaconda), and in Pandas v0.17.1 under Mac OS (Anaconda).

import numpy as np
import pandas as pd

n = 400
n_trials = 1000

df_1 = pd.DataFrame(data=np.random.random((n,n)), index=np.arange(0,n), columns=np.arange(0,n))
df_2 = pd.DataFrame(data=np.random.random((n,n)), index=np.arange(0,n), columns=np.arange(0,n))

count = 0
for i in xrange(0,n_trials):
  res = df_1.where(df_2 > 0.5)
  if (res < 1e-6).all().all():
    count += 1
print "number of unexpected cases: ", count

returns non-zero counts.

@jreback
Copy link
Contributor

jreback commented Feb 12, 2016

duplicate: #12023

install numexpr>=2.4.6 and all will be well.

@jreback jreback closed this as completed Feb 12, 2016
@jreback jreback added Windows Windows OS Compat pandas objects compatability with Numpy or Python functions labels Feb 12, 2016
@zk42
Copy link
Author

zk42 commented Feb 15, 2016

Thanks!

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 Windows Windows OS
Projects
None yet
Development

No branches or pull requests

2 participants