-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
ApplyApply, Aggregate, Transform, MapApply, Aggregate, Transform, MapBugNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsNested DataData where the values are collections (lists, sets, dicts, objects, etc.).Data where the values are collections (lists, sets, dicts, objects, etc.).good first issue
Description
from SO
df = pd.DataFrame({'a':[1,2], 'b':[2,3]})
print (df)
a b
0 1 2
1 2 3
And output is wrong:
print (df.apply(lambda x: [x.values]))
a [[8791439669712, 8791439669712]]
b [[8791439669712, 8791439669712]]
dtype: object
But if convert to list all working nice:
print (df.apply(lambda x: [x.values.tolist()]))
a [[1, 2]]
b [[2, 3]]
dtype: object
print (df.apply(lambda x: [list(x.values)]))
a [[1, 2]]
b [[2, 3]]
dtype: object
What is problem?
Metadata
Metadata
Assignees
Labels
ApplyApply, Aggregate, Transform, MapApply, Aggregate, Transform, MapBugNeeds TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressionsNested DataData where the values are collections (lists, sets, dicts, objects, etc.).Data where the values are collections (lists, sets, dicts, objects, etc.).good first issue