Reputation: 153
Here is what I'm trying to do: I currently have the below plot
x=frequencia['Numero']
y=frequencia['Recorrencia']
plt.bar(x,y)
I'm trying to plot the first 10 highest values. For that, I can sort my DataFrame with
frequencia.sort_values(by=['Recorrencia'], inplace=True, ascending=False)
But if I try to print the first 10 values using .head(10)
, all I get is this second plot.
Is there a way to plot it like below instead?
Upvotes: 1
Views: 62
Reputation: 19610
Try: frequencia = frequencia.sort_values(by=['Recorrencia'])
Then extract the x, y variables to be plotted:
x=frequencia['Numero']
y=frequencia['Recorrencia']
plt.bar(x,y)
Upvotes: 1