python 2.7 - Adding a list of lists in a pandas dataframe column -
i have data frame
a b c 0 1 2 1 6 5
i need add list of lists in 4th column of dataframe . becomes
a b c d 0 1 2 [[4,-0.05],[0.03,[-0.02,0.02]],[0.01,-0.03]] 1 6 5 [[4,-0.35],[0.07,[-0.02,0.02]],[0.91,-0.03]]
please note list of lists in column d. unable find way add type of column data pandas dataframe
appreciate help. in advance
you create new series as
in [11]: df['d'] = pd.series([[[4,-0.05],[0.03,[-0.02,0.02]],[0.01,-0.03]], [[4,-0.35],[0.07,[-0.02,0.02]],[0.91,-0.03]]]) in [12]: df out[12]: b c d 0 0 1 2 [[4, -0.05], [0.03, [-0.02, 0.02]], [0.01, -0.... 1 1 6 5 [[4, -0.35], [0.07, [-0.02, 0.02]], [0.91, -0....
however, i'm not sure, why want store data in structure!
Comments
Post a Comment