我正在尝试drop_duplicates在 a 的列上使用dataframe,
A len
['1', '2'] 2
['1', '2'] 2
['3'] 1
['4', '5'] 2
['4', '5'] 2
Run Code Online (Sandbox Code Playgroud)
结果dataframe应该是这样的
A len
['1', '2'] 2
['3'] 1
['4', '5'] 2
Run Code Online (Sandbox Code Playgroud)
我试过了df.drop_duplicates('A', inplace=True),但有错误,
unhashable type: 'numpy.ndarray'
Run Code Online (Sandbox Code Playgroud)
我还A使用df['A'].apply(list)and转换为列表和集合df['A'].apply(set),然后使用drop_duplicates,但都失败了unhashable type: 'set' and 'list'。我想知道如何解决这个问题。