1

there is something missing in my understanding of groupby.boxplot().

I have a dataFrame DF with dates' andvalues` like below :

                      dates  values
0       2016-10-20 18:19:15  20.8
1       2016-10-20 18:20:15  21.1
2       2016-10-20 18:21:15  21.3
3       2016-10-20 18:22:15  21.6
4       2016-10-20 18:23:15  21.8
5       2016-10-20 18:24:15  22.1
...
...
1176468 2018-09-18 03:17:19  19.7
1176469 2018-09-18 03:18:19  20.0
1176470 2018-09-18 03:19:19  20.2
1176471 2018-09-18 03:20:19  20.4
1176472 2018-09-18 03:21:19  20.6

I grouped DF :

groups = DF.groupby(pd.Grouper(freq='6M', key='dates'))

And then I want a boxplot :

box = groups.boxplot(subplots=False)

The boxplots are fine, but I would like to customized the xaxis "dates" position formats like it is possible with pyplot.boxplot assigning position = mdates.date2num() and using set_major_locator(mdates.YearLocator()) for example.

Does someone know How to do that with groupby.boxplot()?

user3046026
  • 149
  • 1
  • 14
  • Can you provide an example of what one of your xtick labels to look like? – dubbbdan Sep 24 '18 at 18:31
  • It looks like a weird list of tuple, ex : [(2016-01-31 00:00:00,y),(2016-06-31 00:00:00,y),(2017-01-31 00:00:00,y),...etc...]. – user3046026 Sep 24 '18 at 19:14
  • And instead of the 6-month major tick interval, you want to see a major tick interval of 1 year? – dubbbdan Sep 24 '18 at 19:20
  • More or less, I would like to play with the xticklabels formats like here : https://matplotlib.org/gallery/text_labels_and_annotations/date.html – user3046026 Sep 24 '18 at 19:28

0 Answers0