我试图绘制一个条形图来表示低收入票数与高收入票数的平均收入之和,但我遇到了这个错误。我仍然是一个初学者,不知道如何解决它,任何帮助将不胜感激。
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
df_count_0value_revenue= df.groupby('revenue').count()['id']
df_count_0value_revenue.head()
df['revenue']=df['revenue'].replace(0, np.NaN)
high_vote_average= df.query('vote_average > 6.000000')
Low_vote_average= df.query('vote_average < 6.000000')
sum_low_average= Low_vote_average['revenue'].sum()
sum_high_average=high_vote_average['revenue'].sum()
Locations=['Low','High']
Heights=[sum_low_average,sum_high_average]
labels=[Low_vote_average,high_vote_average]
*plt.bar(Locations,Heights,tick_label=labels)<--
plt.title('Sum of Total revenue per Vote average level')
plt.xlabel('Vote Average level')
plt.ylabel('Sum of Total revenue')
数据集是Kaggle上的TMDB 5000电影 我希望有两个条形图,一个条形图表示平均值较低,一个条形图表示较高值,但是我一直收到以下错误:
无法将大小为5055的序列复制到维度为17的数组轴上