I would like to plot a graph but pandas keeps reordering my index (N).
I want the order to be N= 50, 100, 200
where there are three columns for each N
namely 2x2 3x3 4x4
f1 = pd.DataFrame({"User": ["2 x 2 x 2","3 x 3 x 3", "4 x 4 x 4","2 x 2 x 2","3 x 3 x 3", "4 x 4 x 4","2 x 2 x 2","3 x 3 x 3", "4 x 4 x 4"],\
"clm2": profit_comparison[0:len(profit_comparison)],\
"N": ["N=50","N=50","N=50","N=100","N=100","N=100","N=200","N=200","N=200"]})
with PdfPages('profit(n,p).pdf') as pdf:
ax1= df1.pivot(index = "N", columns = "User", values = "clm2").plot.bar(edgecolor = "white")
ax1.set_ylabel("Profit")
pdf.savefig()
plt.close()