I've been trying to plot a data frame as a box plot using matplotlib. My data frame looks something like this:
9-1 9-2 9-3 9-4 9-5
0 23 16.0 18.0 18.0 26
1 27 18.0 20.0 17.0 33
2 10 9.0 15.0 8.0 30
3 23 30.0 19.0 5.0 15
4 10 10.0 23.0 29.0 12
5 50 13.0 8.0 20.0 23
6 12 24.0 31.0 27.0 35
7 10 29.0 NaN 7.0 22
8 34 NaN NaN 16.0 31
9 28 NaN NaN NaN 24
Where every column is a day of a measurement. Below is what my plot looks like. I'd like to be able to plot every day in the box plot, including ones with NaN values. I know that matplotlib only plots the columns where there aren't any NaN values. Would this be possible to do using matplotlib or would I have to convert the data frame into a list of lists or Numpy array? Any help would be appreciated!
I know that there is a function in Pandas where we can put make a box plot using df.boxplot() or df.plot.box(), however, I strongly prefer to use matplotlib's boxplot() function instead. Also, I want to be able to plot the all of the values for days with complete measurements (like 9-1 and 9-5) instead of cutting them off to correspond to all the valid rows in the days with NaN values.
For images of the boxplot, https://i.sstatic.net/pBh6pEdf.png is what I produced and https://imgur.com/a/vvDFNR1 is what I'm trying to create with matplotlib's boxplot() function.
