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.