How to fill dataframe Nan values with empty list [] in pandas?

后端 未结 11 758
粉色の甜心
粉色の甜心 2020-12-24 11:02

This is my dataframe:

          date                          ids
0     2011-04-23  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,...
1     2011-04-24  [0,         


        
11条回答
  •  [愿得一人]
    2020-12-24 11:52

    This is probably faster, one liner solution:

    df['ids'].fillna('DELETE').apply(lambda x : [] if x=='DELETE' else x)
    

提交回复
热议问题