2021年1月19日星期二

pandas column of list type

Need to generate a dataframe, column 'b' is of list type.

temp = pd.DataFrame(columns=['a','b')]      temp['a'] = 1  temp['b'] = [2,3]  

expected result will be

a    b  1    [2,3]  

but now the result is

a   b  NaN 2  NaN 3  

How to get expected result?

https://stackoverflow.com/questions/65802384/pandas-column-of-list-type January 20, 2021 at 10:46AM

没有评论:

发表评论