python - pandas: ValueError when assigning DataFrame entries using index due to a change since v 0.13.1 -


i begin concrete example:

the following works on;

  • pandas version: 0.13.1
  • numpy version: 1.8.0 b

    but not on;

  • pandas version: 0.14.0

  • numpy version: 1.8.1

import pandas pd import numpy np = pd.dataframe(np.random.rand(10,4), index=np.random.rand(10)) a.loc[a.index] = a.loc[a.index] in pandas newer version results in:

valueerror: truth value of array more 1 element ambiguous. use a.any() or a.all()

i did not figure out change 0.13.1 -> 0.14.0 , how should modify code.

for wondering application: useful when large dataframe needs updated iteratively, each time sub-frame. real-life code resembles more:

while something: ... a.loc[b.index] = a.loc[b.index].add(b, fill_value=0) ... index of b subset of index of a


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -