I was surprised to find that having a dataframe with a datetime column that contains a NULL, even if that column is not used, causes an error. (ValueError: NaTType does not support timetuple) Is this expected behavior?
Here is a simple example. Attached is the jupyter notebook I used.
import pandas as pd
pd.options.display.max_rows = 10
from bokeh.plotting import figure, output_notebook, output_file, show
output_file(‘broken.html’)
some fake data
data = pd.DataFrame({‘time’:[‘09:30’,‘10:00’,‘10:05’,‘10:30’], ‘prc’:[5,5.25,6,7]})
data.time = pd.to_datetime(data.time)
data[‘time_not_used’] = data.time # causes no problems
create an column we will not use, but set a value to NaT
data[‘time_not_used’] = data.time.where(data.time!=‘2017-02-13 10:05:00’)
print(data.info())
print(data)
p = figure(x_axis_type=‘datetime’)
p.circle(x=‘time’, y=‘prc’, source=data, color=‘red’, size=10)
show(p) # throws “ValueError: NaTType does not support timetuple”
``
ErrorExample.ipynb (27 KB)

