You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is indeed odd.
There also seems to be a dependency on the dtype. Below an example for all ints and all floats.
In [121]: df
Out[121]:
A B
a 7 0
b 7 -2
In [122]: df.apply(foo, 1)
Out[122]:
A B
a NaN NaN
b NaN NaN
All NaN???
I would expect to see this:
In [123]: s = pandas.Series([foo(row[1]) for row in df.iterrows()], df.index)
In [124]: s
Out[124]:
a {'properties': {'A': 7, 'B': 0}}
b {'properties': {'A': 7, 'B': -2}}
Seems to work fine for all floats.
In [125]: df = pandas.DataFrame(np.random.randn(2, 2), columns=list('AB'), index=list('ab'))
In [126]: df
Out[126]:
A B
a -0.407883 0.018206
b -1.081038 0.492944
In [127]: df.apply(foo, 1)
Out[127]:
a {'properties': {'A': -0.407882576359619, 'B': 0.0
b {'properties': {'A': -1.081038117264707, 'B': 0.4
The text was updated successfully, but these errors were encountered:
The first I can't repro, seems to be fixed.
the second is a case of type sniffing gone wrong, if an exception
is raised due to unequal len arrays in list, it will now fall back and match
the behaviour for a list of unequal lists. 6626a7a
from the mailing list cc @lodagro
The text was updated successfully, but these errors were encountered: