-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: .apply with collections #39166
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
Comments
Thanks for the report! Agree this is unexpected, likely due to some optimizations
gives
|
Does this related with: |
While somewhat related to #35462, I think this issue is different in at least one important aspect: the code the leads to this behavior does not mutate the input |
consider following example:
but if use numpy array to replace list, i.e.
I can not understand the conclusion use list (first example)
if pandas take element in apply(axis = 1) as pd.Series
And [x] cast it to nest list for example ,
First Row [[0, 1, 2]] * 2 -> [[0, 1, 2], [0, 1, 2]]
Second Row [[3, 4, 5]] * 2 -> [[3, 4, 5], [3, 4, 5]]
should not have above conclusion.
It seems pandas only maintain the last row and apply it to all rows.
And when use replace [x] by {“x”: x},
Have similar problem.
I can understand use numpy collection and pandas collection
inside the elements of DataFrame (avoid use list tuple or dict) may be more safe.
But please explain this conclusion for me.
My pandas version is 1.1.3
The text was updated successfully, but these errors were encountered: