Временные сюжеты с Bokeh

Я пытаюсь построить график Timeseries с категориями.

xaxis_values: startTIme yaxis_values: count

groupby: day

Каждый день есть 24-часовые данные, и, как и весь этот набор данных, более 100 дней я стараюсь иметь несколько типов графиков.

  1. startTime по day и startTime все counts за каждый час от startTime который даст 7 графиков временных рядов на одном графике.

  2. Разделяйте по дням, т.е. каждый mon, tue, wed и т. Д. Независимо от количества дней n и график 24-часового ряда.

  3. Группируйте по часам независимо от дней. т.е. 00:00:00, 01:00:00 и т. д.

Каков наилучший способ получить лучшую визуализацию с боке или морским дном.

Входные данные:

 2004-01-05,22:00:00,23:00:00,Mon,18944,790 2004-01-05,23:00:00,00:00:00,Mon,17534,750 2004-01-06,00:00:00,01:00:00,Tue,17262,747 2004-01-06,01:00:00,02:00:00,Tue,19072,777 2004-01-06,02:00:00,03:00:00,Tue,18275,785 2004-01-06,03:00:00,04:00:00,Tue,13589,757 2004-01-06,04:00:00,05:00:00,Tue,16053,735 2004-01-06,05:00:00,06:00:00,Tue,11440,636 2004-01-06,06:00:00,07:00:00,Tue,5972,513 2004-01-06,07:00:00,08:00:00,Tue,3424,382 2004-01-06,08:00:00,09:00:00,Tue,2696,303 2004-01-06,09:00:00,10:00:00,Tue,2350,262 2004-01-06,10:00:00,11:00:00,Tue,2309,254 

Код: Ссылка: Здесь

 import numpy as np import pandas as pd from bokeh.charts import TimeSeries, show, output_file, vplot output_file("timeseries.html") data_one = pd.read_csv('one_hour.csv') data_one.columns = ['date', 'startTime', 'endTime', 'day', 'count', 'unique'] data = dict(data_one=data_one['count']) tsline = TimeSeries(data, x='startTime', y='count', color=['day'], title="Timeseries", ylabel='count', legend=True) show(vplot(tsline)) 

Ошибка:

 Traceback (most recent call last): File "date_graph.py", line 10, in <module> data = dict(data_one=data_one['count']) File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 1997, in __getitem__ return self._getitem_column(key) File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2004, in _getitem_column return self._get_item_cache(key) File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 1350, in _get_item_cache values = self._data.get(item) File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3290, in get loc = self.items.get_loc(item) File "/usr/local/lib/python2.7/dist-packages/pandas/indexes/base.py", line 1947, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/index.pyx", line 137, in pandas.index.IndexEngine.get_loc (pandas/index.c:4154) File "pandas/index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas/index.c:4018) File "pandas/hashtable.pyx", line 675, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12368) File "pandas/hashtable.pyx", line 683, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12322) KeyError: 'count 

Изменить: после изменения

 data = dict(data_one=data_one['count'].tolist()) 

Ошибка:

 Traceback (most recent call last): File "date_graph.py", line 12, in <module> tsline = TimeSeries(data, x='startTime', y='count', color=['startTime'], title="Timeseries", ylabel='count', legend=True) File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/builders/timeseries_builder.py", line 102, in TimeSeries return create_and_build(builder_type, data, **kws) File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/builder.py", line 67, in create_and_build chart.add_builder(builder) File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/chart.py", line 149, in add_builder builder.create(self) File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/builder.py", line 518, in create chart.add_renderers(self, renderers) File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/chart.py", line 144, in add_renderers self.renderers += renderers File "/usr/local/lib/python2.7/dist-packages/bokeh/core/property_containers.py", line 18, in wrapper result = func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/bokeh/core/property_containers.py", line 77, in __iadd__ return super(PropertyValueList, self).__iadd__(y) File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/builders/line_builder.py", line 230, in yield_renderers x=group.get_values(self.x.selection), File "/usr/local/lib/python2.7/dist-packages/bokeh/charts/data_source.py", line 173, in get_values return self.data[selection] File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 1997, in __getitem__ return self._getitem_column(key) File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2004, in _getitem_column return self._get_item_cache(key) File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 1350, in _get_item_cache values = self._data.get(item) File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3290, in get loc = self.items.get_loc(item) File "/usr/local/lib/python2.7/dist-packages/pandas/indexes/base.py", line 1947, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/index.pyx", line 137, in pandas.index.IndexEngine.get_loc (pandas/index.c:4154) File "pandas/index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas/index.c:4018) File "pandas/hashtable.pyx", line 675, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12368) File "pandas/hashtable.pyx", line 683, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12322) KeyError: 'startTime' 

Python - лучший язык программирования в мире.