AttributeError:'函数'对象没有属性'头'[关闭]

我遇到了错误,但我真的不明白怎么了

import pandas as pd
import matplotlib.pyplot as plt
# Add first subplot
plt.subplot(2, 1, 1)

# Create a histogram of life_expectancy
gapminder.life_expectancy.plot(kind = 'hist')

# Group gapminder: gapminder_agg
gapminder_agg = gapminder.groupby('year')['life_expectancy'].mean

print(gapminder_agg.head())

AttributeError: 'function' object has no attribute 'head'

尾巴也有同样的问题

评论