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
Very long answer:
I think this is a case where pandas is too clever by half.
When your grouper is a function, it's applied using index.map. index.map tries really hard to guess what you want, and so if the function
throws an exception when applied to the elements, it's tried again on the entire
index as a sequence and the result is used as the grouping result.
Presumably, lambda key: str(key)[0:4] is what you wanted, but you're using key[0:4] when
key is a Timestamp, so that failes, the fallback path is triggered and you end
up getting the first 4 elements of the index, rather then a sequence of the first
4 chars of each element.
That produces a label/data len mismatch, which is uncaught by the cython code
down the road, which borks (similar to #3011 from a few days ago, but a different code path).
The fix in #3011, still doesn't address the corner case where an erroneous lambda throws an exception
on the element, but returns a result of the correct length when applied to the entire index:
It is a dumb thing to do, but pandas probably shouldn't segfault regardless:
Tested with pandas 10.1 on win32/win64, Python 2.7 and pandas 0.11.0.dev-2f7b0e4 on win32, Python 2.7.
The text was updated successfully, but these errors were encountered: