Pandas Flatten a list of list within a column?
问题 I am trying to flatten a column which is a list of lists: var var2 0 9122532.0 [[458182615.0], [79834910.0]] 1 79834910.0 [[458182615.0], [9122532.0]] 2 458182615.0 [[79834910.0], [9122532.0]] I want: var var2 0 9122532.0 [458182615.0, 79834910.0] 1 79834910.0 [458182615.0, 9122532.0] 2 458182615.0 [79834910.0, 9122532.0] Applying sample8['var2'] = sample8['var2'].apply(chain.from_iterable).apply(list) Gives me: var1 var2 0 9122532.0 [[, 4, 5, 8, 1, 8, 2, 6, 1, 5, ., 0, ], [, 7, ... 1