HP, Attack, and Defense: Analyzing Pokemon Stats with Pandas
You can use the groupby method to group by the first level of the column index and then use the sum function to sum the columns labeled 'max' in the second level. Here's an example:
df.groupby(level=0, axis=1).sum()
This will return a new DataFrame where the columns labeled 'max' have been summed.
原文地址: https://www.cveoy.top/t/topic/futH 著作权归作者所有。请勿转载和采集!