Pandas Plot Giving Incorrect X Axis Values

by Demni   Last Updated October 07, 2018 19:26 PM

I am working on the titanic competition at kaggle.

Can anyone explain why my x- axis is coming in out of order? The data appears to be in the right order. It's literally just the labels being out of order.

group = pd.cut(df_train.Age, [0,14,30,60,100])
piv_fare = df_train.pivot_table(index=group, columns='Survived', values = 'Age', aggfunc='count')

I was expecting the bin order to be [0,14], [14,30], [30,60], [60,100]. Instead I got [14,30], [30,60], nan, [10,14].

Tags : python pandas plot

Related Questions

Groupby and Plot bar graph in Python

Updated September 17, 2018 03:26 AM

Adding Legends in Pandas Plot

Updated May 28, 2017 10:26 AM

How to save Pandas pie plot to a file?

Updated November 21, 2017 05:26 AM

Python pandas plotting Quarter values

Updated January 06, 2018 17:26 PM