1.pd.value_counts(value)
计数,每个数字或字符的个数。
list = [2,4,6,8,10,6,8]
print(pd.value_counts(list))
输出:
2.pd.value_counts(value).index
只要value中的元素(不重复)
list = [2,4,6,8,10,6,8]
a = pd.value_counts(list).index.tolist()
print(a)
输出:[6, 8, 4, 10, 2]
计数,每个数字或字符的个数。
list = [2,4,6,8,10,6,8]
print(pd.value_counts(list))
输出:
只要value中的元素(不重复)
list = [2,4,6,8,10,6,8]
a = pd.value_counts(list).index.tolist()
print(a)
输出:[6, 8, 4, 10, 2]