Closed
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?