Group operations on Pandas column containing lists

后端 未结 2 533
南笙
南笙 2021-01-18 13:00

I have a DataFrame containing a column, props, which contains lists of strings.

Ideally, I\'d like to group by this column, but I predictably get an err

2条回答
  •  温柔的废话
    2021-01-18 13:32

    You can convert the lists of strings into tuples of strings. Tuples are hashable, as they are unmutable. This is of course assuming that you don't need to be adding to or removing from those lists after creation.

提交回复
热议问题