How to make a distplot-like histogram using dates instead of numbers?

I’m trying to make a distplot similar to https://plot.ly/python/distplot/, however instead of passing a series of numbers in as data, I want to instead pass in some sort of date object. My objective is to create a histogram over time, so the X axis represents a linear progression of time and the Y axis represents the number of dates which fell inside that time.

Whenever I pass in my array of arrays of Python datetime objects (I’m plotting multiple datasets) to Plotly via ff.create_distplot(data, labels), I receive the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-0d5a9378ec39> in <module>()
      4                          bin_size=30,
      5                          rug_text=[pk_rug, ym_rug, sm_rug],
----> 6                          histnorm="probability"
      7                         )
      8 

/Users/miles/Library/Python/2.7/lib/python/site-packages/plotly/figure_factory/_distplot.pyc in create_distplot(hist_data, group_labels, bin_size, curve_type, colors, rug_text, histnorm, show_hist, show_curve, show_rug)
    179         hist_data, histnorm, group_labels, bin_size,
    180         curve_type, colors, rug_text,
--> 181         show_hist, show_curve).make_hist()
    182 
    183     if curve_type == 'normal':

/Users/miles/Library/Python/2.7/lib/python/site-packages/plotly/figure_factory/_distplot.pyc in __init__(self, hist_data, histnorm, group_labels, bin_size, curve_type, colors, rug_text, show_hist, show_curve)
    268 
    269         for trace in self.hist_data:
--> 270             self.start.append(min(trace) * 1.)
    271             self.end.append(max(trace) * 1.)
    272 

TypeError: unsupported operand type(s) for *: 'Timestamp' and 'float'

However, when I pass in an array of arrays of ordinals (integer representations of dates), I get exactly what I’m looking for, except with difficult to understand labels (I need them to be formatted as dates):

Also, is it possible to turn the Y axis not into probability, but rather size of the bin?

Any and all help is appreciated. I’m a new Plotly user, by the way, so I apologize if this is an easy question!

Thanks,
Miles

However, when I pass in an array of arrays of ordinals (integer representations of dates), I get exactly what I’m looking for, except with difficult to understand labels (I need them to be formatted as dates)

I’m not :100: this will work, but try inputing your dates in this string format:

distplot might simply not convert Python datetimes to the string format Plotly.js understands.

Also, is it possible to turn the Y axis not into probability, but rather size of the bin?

Check out histfunc and histnorm here:

https://plot.ly/python/reference/#histogram

I think this is the case, as I entered the date as YYYY-MM-DD (according to the Plotly specification), and I received the following error: TypeError: can't multiply sequence by non-int of type 'float'

I’ll try using the the other functions you mentioned, and we’ll see if those work.