Python 属性错误:';AxesSubplot';对象没有属性';nLAGEST';

Python 属性错误:';AxesSubplot';对象没有属性';nLAGEST';,python,pandas,Python,Pandas,此错误是什么意思:AttributeError:'AxeSubplot'对象没有属性'NLAGEST'意味着什么? import numpy as np import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('persons-arrested-for-selected-major-offences-by-age-group.csv', index_col="level_1") df2 = df.dropna()

此错误是什么意思:AttributeError:'AxeSubplot'对象没有属性'NLAGEST'意味着什么?

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('persons-arrested-for-selected-major-offences-by-age-group.csv', index_col="level_1")
df2 = df.dropna()

df_year = df2[df2['year']==2018]
df_age = df_year[df_year['level_2']=='21 Years Old And Below']

df_offences = df_age.drop_duplicates().sort_values('level_1', ascending=False)
df_offences.plot.bar(figsize = (15,6)).nlargest(3,['level_1','value'])
plt.show()

我试图展示犯罪中的前三个值,那么你应该做
dfu offenses.nlagest(…).plot.bar(…)