📜  在 Pandas DataFrame 中查找和计算单个列的唯一值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:16.810000             🧑  作者: Mango

代码示例1
# import pandas library
import pandas as pd

# create pandas DataFrame
df = pd.DataFrame({'fruits': ['orange', 'mango', 'apple', 'grapes', 'orange', 'mango'],
                   'price': ['40', '80', '30', '40', '30', '80'],
                   'quantity': ['200', '300', '300', '400', '200', '800']
                   })

# get the count unique values of column fruits
print(df.fruits.value_counts())