简体   繁体   中英

count of occurances in pandas dataframe

my dataset looks likes this after executing groupby. How can I sum the common systems in column 3

在此处输入图像描述

You can achieve this by using pandas .value_counts() method:

df['col3'].value_counts()

Yields:

sys1    3
sys4    1
sys5    1
sys2    2
Name: col3, dtype: int64

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM