具有不易损坏类型的柱的唯一性

2024-04-27 18:40:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我的三篇专栏中有两篇对.nunique()反应良好

print(df.Column1.nunique())
>>> 45
print(df.Column2.nunique())
>>> 23

但另一列:

^{pr2}$

…给出回溯,最后两行如下:

pandas/src/hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.unique (pandas/hashtable.c:14999)()

TypeError: unhashable type: 'RequestsCookieJar'

在Jupyter中查看df时,您可以在某种程度上直观地看到cookies之间的差异,可以这样开始:

[<Cookie 1P_JAR=2018-03-07-09

…另一个是这样的:

[<Cookie 1P_JAR=2018-03-07-08

有没有一个快速的方法可以告诉你其中有多少是独一无二的?在


Tags: srchelperpandasdfcookieclassjarprint