Problem with boxplot

Screen Link: https://app.dataquest.io/m/348/guided-project%3A-clean-and-analyze-employee-exit-surveys/5/verify-the-data

My Code:

dete_resignations.boxplot(column=['cease_date'])

What I expected to happen:
A boxplot with the years

What actually happened:

Something I don’t understand

2 Likes

I am not sure why this happens. But to fix this you can try to specify the range limit for the y-axis labels/ticks -

dete_resignations.boxplot(column=['cease_date']).set_ylim(2005,2015)

The above is one way to do it.

2 Likes

What you are seeing is offset. You can turn off that using ticklabel_format

dete_resignations.boxplot(column=['cease_date'])
plt.ticklabel_format(useOffset=False, axis='y')

Here you have 0 to 8 numbers on y-axis tick values if you want to know actual values you have to add your offset into tick values. Like here your offset is +2.006e3 (It is scientific notation for 2006)

So, [tick values + offset = actual value]

0 on y axis means 2006 year [0 + 2006 = 2006]
1 on y axis means 2007 year [1 + 2006 = 2007]
2 on y axis means 2008 year [2 + 2006 = 2008]

Note: Here we are adding an offset because the offset starts with a + sign. If it starts with a - sign then we will do subtraction.

2 Likes