Timedelta Error

Hello All,

I am new to coding in general and have been using a raspberry pi along with my macbook pro as a test bench for my python creations.

My most recent project was to run a python program every 5 minutes which uses a DH11 sensor to measure the temperature and humidity to a csv file.

I was then attempting to use Bokeh with Pandas to retrieve and plot the data every 10 minutes and generate a html file which could then be hosted on a web file.

This in practice worked perfectly on my laptop however when moving over to my raspberry pi the python program plotting the data returned this error:

Traceback (most recent call last):

File “DataAnalysis.py”, line 2, in

from bokeh.plotting import figure, output_file, show

File “/usr/local/lib/python2.7/dist-packages/bokeh/plotting/init.py”, line 2, in

from …document import Document; Document

File “/usr/local/lib/python2.7/dist-packages/bokeh/document.py”, line 28, in

from .core.json_encoder import serialize_json

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”, line 49, in

from …util.serialization import convert_datetime_type, is_datetime_type, transform_series, transform_array

File “/usr/local/lib/python2.7/dist-packages/bokeh/util/serialization.py”, line 55, in

DATETIME_TYPES.add(pd.Timedelta)

AttributeError: ‘module’ object has no attribute ‘Timedelta’

Running Python 2.7, Bokeh 0.12.6

File DataAnlysis.py:

import pandas

from bokeh.plotting import figure, output_file

import time

import datetime

data = pandas.read_csv(“http://antondubek.hopto.org/dataFile.csv”, parse_dates = [“Time”])

p = figure(plot_width = 500, plot_height = 250, x_axis_type = ‘datetime’, responsive = True)

p.line(data[“Time”], data[“Humidity”], color = “Blue”, alpha = 0.5)

p.circle(data[“Time”], data[“Humidity”], size = 5, color = “Blue”)

p.line(data[“Time”], data[“Temperature”], color = “Red”, alpha = 0.5)

p.circle(data[“Time”], data[“Temperature”], size = 5, color = “Red”)

output_file("/var/www/html/TempReadings.html")

I have searched the web as best I can, uninstalled bokeh and reinstalled it both using pip still with no luck.

Any help would be appreciated.

Hi,

TimeDelta is a somewhat recent addition to Pandas, 0.15 I think. You will need to update your installed Pandas to a newer version that has this TimeDelta feature.

Thanks,

Bryan

···

On Jul 10, 2017, at 07:51, [email protected] wrote:

Hello All,

I am new to coding in general and have been using a raspberry pi along with my macbook pro as a test bench for my python creations.

My most recent project was to run a python program every 5 minutes which uses a DH11 sensor to measure the temperature and humidity to a csv file.

I was then attempting to use Bokeh with Pandas to retrieve and plot the data every 10 minutes and generate a html file which could then be hosted on a web file.

This in practice worked perfectly on my laptop however when moving over to my raspberry pi the python program plotting the data returned this error:

Traceback (most recent call last):
  File "DataAnalysis.py", line 2, in <module>
    from bokeh.plotting import figure, output_file, show
  File "/usr/local/lib/python2.7/dist-packages/bokeh/plotting/__init__.py", line 2, in <module>
    from ..document import Document; Document
  File "/usr/local/lib/python2.7/dist-packages/bokeh/document.py", line 28, in <module>
    from .core.json_encoder import serialize_json
  File "/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py", line 49, in <module>
    from ..util.serialization import convert_datetime_type, is_datetime_type, transform_series, transform_array
  File "/usr/local/lib/python2.7/dist-packages/bokeh/util/serialization.py", line 55, in <module>
    DATETIME_TYPES.add(pd.Timedelta)
AttributeError: 'module' object has no attribute 'Timedelta'

Running Python 2.7, Bokeh 0.12.6

File DataAnlysis.py:

import pandas
from bokeh.plotting import figure, output_file
import time
import datetime

data = pandas.read_csv("http://antondubek.hopto.org/dataFile.csv", parse_dates = ["Time"])

p = figure(plot_width = 500, plot_height = 250, x_axis_type = 'datetime', responsive = True)

p.line(data["Time"], data["Humidity"], color = "Blue", alpha = 0.5)
p.circle(data["Time"], data["Humidity"], size = 5, color = "Blue")

p.line(data["Time"], data["Temperature"], color = "Red", alpha = 0.5)
p.circle(data["Time"], data["Temperature"], size = 5, color = "Red")

output_file("/var/www/html/TempReadings.html")

I have searched the web as best I can, uninstalled bokeh and reinstalled it both using pip still with no luck.

Any help would be appreciated.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/7dd77ed1-38d4-4373-9120-1f1ccb1f10e7%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.