报错unhashable type: 'numpy.ndarray',想问问怎么改哇!
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df=pd.read_excel('/Users/mac/Desktop/实验七 数据包(1)/B39.xlsx')
plt.rcParams['font.sans-serif']=['Songti SC']
labels=np.array(['食品支出','衣着支出','居住','家庭设备及用品','医疗保健','交通和通信','文教娱乐服务','其他'])
dataLenth=6
df1=np.array(df[df['地区']=='北京'])
df2=np.array(df[df['地区']=='天津'])
df3=np.array(df[df['地区']=='上海'])
df4=np.array(df[df['地区']=='重庆'])
angles=np.linspace(0,2*np.pi,dataLenth,endpoint=False)
df1=np.concatenate((df1,[df1[0]]))
df2=np.concatenate((df2,[df2[0]]))
df3=np.concatenate((df3,[df3[0]]))
df4=np.concatenate((df4,[df4[0]]))
angles=np.concatenate((angles,[angles[0]]))
plt.polar(angles,df1,color='r',linestyle='-',marker='v',linewidth=2,label='北京')
plt.fill(angles,df1,facecolor='r',alpha=0.5)
plt.polar(angles,df2,color='c',linestyle='--',marker='+',linewidth=2,label='天津')
plt.fill(angles,df2,facecolor='c',alpha=0.5)
plt.polar(angles,df3,color='purple',linestyle='-·',marker='s',linewidth=2,label='上海')
plt.fill(angles,df3,facecolor='purple',alpha=0.5)
plt.polar(angles,df4,color='gray',linestyle=':',marker='p',linewidth=2,label='重庆')
plt.fill(angles,df4,facecolor='gray',alpha=0.5)
plt.thetagrids(range(0,360,45),labels)
plt.ylim(0,10000)
plt.legend(loc='upper right',bbox_to_anchor=(1.2,1.1))
plt.show()