I just started playing with the DataTable in bokeh. Very cool!
One thing I found that didn’t work or I didn’t know how to do was trying to display dates. A simple example is below. I looked for a DateFormatter but didn’t see one in widgets although I saw various other Date related classes.
If anyone knows how to do this please let me know. If the functionality doesn’t exist and it requires python work and someone can point me to where to get started i’d be happy to give it a try. I’m pretty weak on javascript so if that’s needed I might bow out.
I just started playing with the DataTable in bokeh. Very cool!
One thing I found that didn’t work or I didn’t know how to do was trying to display dates. A simple example is below. I looked for a DateFormatter but didn’t see one in widgets although I saw various other Date related classes.
If anyone knows how to do this please let me know. If the functionality doesn’t exist and it requires python work and someone can point me to where to get started i’d be happy to give it a try. I’m pretty weak on javascript so if that’s needed I might bow out.
This is an unfortunate omission, but there is current no support for dates/times/datetimes in DataTable. This will be implemented in bokeh 0.7.1.
Mateusz
–Tom
–
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].
I just started playing with the DataTable in bokeh. Very cool!
One thing I found that didn’t work or I didn’t know how to do was trying to display dates. A simple example is below. I looked for a DateFormatter but didn’t see one in widgets although I saw various other Date related classes.
If anyone knows how to do this please let me know. If the functionality doesn’t exist and it requires python work and someone can point me to where to get started i’d be happy to give it a try. I’m pretty weak on javascript so if that’s needed I might bow out.
This is an unfortunate omission, but there is current no support for dates/times/datetimes in DataTable. This will be implemented in bokeh 0.7.1.
Mateusz
–Tom
–
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].
Just wanted to say that I updated to the latest dev build (from Jan 9) and noticed that model.DateFormatter now exists and works quite nicely. It takes a string of the form “m/d/yy” for instance which is quite easy to use. If you added it Mateusz, thank you! Or thank you to whomever did.
I’m re-posting the working example with the DateFormatter so anyone who finds this on Google will have the answer easily available.
from bokeh import plotting
from bokeh import models
from bokeh.models import widgets
import pandas, datetime, numpy
import bokeh
print(bokeh.version)
plotting.output_notebook()
df = pandas.DataFrame(dict(Date = [datetime.date(2014, 1,1), datetime.date(2014, 1,2), datetime.date(2014, 1,3)], Value = [1,2,3]))
df[‘Date’] = pandas.to_datetime(df[‘Date’]) # annoyingly the way I built the data frame, pandas makes the “Date” column an object
source = models.ColumnDataSource(df)
columns = [
widgets.TableColumn(field=c, title=c, formatter=models.DateFormatter(format=‘m/d/yy’) if numpy.issubdtype(df[c].dtype, numpy.datetime64) else None) for c in df.columns
]
data_table = widgets.DataTable(source=source, columns=columns, editable=True, width = 500)
plotting.show(data_table)
``
–Tom
···
On Sunday, December 21, 2014 at 9:48:18 PM UTC-5, Tom Denniston wrote:
Thanks Mateusz!
On Thu, Dec 18, 2014 at 10:35 AM, Mateusz Paprocki [email protected] wrote:
I just started playing with the DataTable in bokeh. Very cool!
One thing I found that didn’t work or I didn’t know how to do was trying to display dates. A simple example is below. I looked for a DateFormatter but didn’t see one in widgets although I saw various other Date related classes.
If anyone knows how to do this please let me know. If the functionality doesn’t exist and it requires python work and someone can point me to where to get started i’d be happy to give it a try. I’m pretty weak on javascript so if that’s needed I might bow out.
This is an unfortunate omission, but there is current no support for dates/times/datetimes in DataTable. This will be implemented in bokeh 0.7.1.
Mateusz
–Tom
–
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].