iris.groupby('species').describe()
我正在使用上面这段代码,它为我提供了一个按物种分组的所有变量的摘要。
我只是想看一个变量的总和,我试过这段代码 iris['sepal_lenght'].groupby('species').describe()
但是没有用。
有谁知道如何解决这个问题?
首先,sepal_lenght的拼写是错误的,应该是sepal_length。此外,你可以尝试 iris.groupby('species').describe()['sepal_length']