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
Today @mi-dai and myself were working on packing SALT3 data into nested pandas. When we tried to run nf.add_nested(src, on='SNID', name='lc') it failed, because it happened that SNID column had object dtype and consisted of heterogeneous data: numbers and strings. A reproducible example:
It failed in our code, basically because this doesn't work in pandas:
nd.set_index('SNID').sort_index()
I'm not sure if it is our problem or not. We potentially may fix this use-case with catching the TypeError and trying to cast on column values to str. Or we can do nothing, because we wouldn't like to change user's data and fix pandas behavior.
Before submitting
Please check the following:
I have described the situation in which the bug arose, including what code was executed, information about my environment, and any applicable data others will need to reproduce the problem.
I have included available evidence of the unexpected behavior (including error messages, screenshots, and/or plots) as well as a description of what I expected instead.
If I have a solution in mind, I have provided an explanation and/or pseudocode and/or task list.
The text was updated successfully, but these errors were encountered:
hombit
changed the title
Packing on object column may fail if items are not comparable
Packing on an object-dtyped column may fail if items are not comparable
Mar 6, 2025
Bug report
Today @mi-dai and myself were working on packing SALT3 data into nested pandas. When we tried to run
nf.add_nested(src, on='SNID', name='lc')
it failed, because it happened thatSNID
column had object dtype and consisted of heterogeneous data: numbers and strings. A reproducible example:It failed in our code, basically because this doesn't work in pandas:
I'm not sure if it is our problem or not. We potentially may fix this use-case with catching the
TypeError
and trying to caston
column values tostr
. Or we can do nothing, because we wouldn't like to change user's data and fix pandas behavior.Before submitting
Please check the following:
The text was updated successfully, but these errors were encountered: