HP, Attack, Defense: Analyzing Pok←mon Stats with Pandas
You can use pandas' groupby and sum methods to add the rows where the second-level column is named 'max'. Here's how:
First, use groupby to group by the first-level column ('Type 1').
Then, use sum to add the values in the 'max' column for each group.
Here's an example code:
df.groupby('Type 1')['max'].sum()
原文地址: https://www.cveoy.top/t/topic/futJ 著作权归作者所有。请勿转载和采集!