我有以下数据框
event_time day
0 2017-06-08 13:35:56.41 2017-06-08
1 2017-06-08 13:35:24.62 2017-06-08
2 2017-06-14 17:44:32.49 2017-06-14
3 2017-06-08 14:40:40.79 2017-06-08
4 2017-06-08 13:40:04.54 2017-06-08
然后我尝试将直方图绘制为每天的事件计数,如:
%matplotlib notebook
my_df.hist(column = 'day')
但是得到了以下错误。知道我做错了什么以及如何获得正确的事件计数直方图?谢谢!
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-11-2a39070c9855> in <module>()
1 get_ipython().magic('matplotlib notebook')
----> 2 my_df.hist(column = 'day')
/usr/local/lib/python3.4/dist-packages/pandas/tools/plotting.py in hist_frame(data, column, by, grid, xlabelsize, xrot, ylabelsize, yrot, ax, sharex, sharey, figsize, layout, bins, **kwds)
2919 fig, axes = _subplots(naxes=naxes, ax=ax, squeeze=False,
2920 sharex=sharex, sharey=sharey, figsize=figsize,
-> 2921 layout=layout)
2922 _axes = _flatten(axes)
2923
/usr/local/lib/python3.4/dist-packages/pandas/tools/plotting.py in _subplots(naxes, sharex, sharey, squeeze, subplot_kw, ax, layout, layout_type, **fig_kw)
3412
3413 # Create first subplot separately, so we can share it if requested
-> 3414 ax0 = fig.add_subplot(nrows, ncols, 1, **subplot_kw)
3415
3416 if sharex:
/usr/local/lib/python3.4/dist-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs)
1018 self._axstack.remove(ax)
1019
-> 1020 a = subplot_class_factory(projection_class)(self, *args, **kwargs)
1021
1022 self._axstack.add(key, a)
/usr/local/lib/python3.4/dist-packages/matplotlib/axes/_subplots.py in __init__(self, fig, *args, **kwargs)
62 raise ValueError(
63 "num must be 1 <= num <= {maxn}, not {num}".format(
---> 64 maxn=rows*cols, num=num))
65 self._subplotspec = GridSpec(rows, cols)[int(num) - 1]
66 # num - 1 for converting from MATLAB to python indexing
ValueError: num must be 1 <= num <= 0, not 1