Shape mismatch: objects cannot be broadcast to a single shape

In the guided project: Star Wars Survey
When I want to plot the mean() i get an error if I use the code below:
error: shape mismatch: objects cannot be broadcast to a single shape, males[males.columns[9:15]].mean()), females[females.columns[9:15]].mean())

But when i used the code below it does plot:,males.iloc[:,9:15].mean())
plt.title(‘Males Mean Ranking’), females.iloc[:,9:15].mean())
plt.title(‘Females Mean Ranking’)

But I don’t get the same error for the sum() method, the code below does plot:[range(6),males[males.columns[3:9]].sum())
plt.title(‘Males Seen Sum’),females[females.columns[3:9]].sum())
plt.title(‘Females Seen Sum’)

So what is the difference between using: dataframe[dataframe.columns] vs
dataframe.iloc[:] when using plt.plot?

Very strange, mean and sum should not make a difference to the dimensions of the output data structure, only values. If your 3rd code block can plot, i don’t see why the 1st code block cannot, since both are using dataframe[dataframe.columns].

That shape mismatch error occurs when you call with too little/many x values compared to height values. Could you check on this?, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)

You can make your question more readable by wrapping single line code with single backticks ` and code blocks with triple backticks ``` (opening and closing both on their own lines)

single backtick

Triple backtick line 1
Triple backtick line 2