Support for datetime64
- Dominant language
- Python
- Stars
- 3.6k
- Forks
- 376
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 1
Description
Hi @jbednar thank you for writing such a useful library... It has so much potential...
Are there any plans to support numpy's datetime64 datatype, or pandas DatetimeIndexes more generally? When I add the following lines to examples/tseries.ipynb
`from datetime import datetime`
`startdt, enddt = [datetime.fromtimestamp(d) for d in start, end]`
`ts = pd.date_range(startdt, periods=n, freq=(enddt - startdt) / n)`
`df['ts'] = ts.values`
and then choose to plot 'ts' on the x-axis:
`cvs = ds.Canvas(x_range=x_range, y_range=y_range, plot_height=300, plot_width=900)`
`aggs= OrderedDict((c, cvs.line(df, 'ts', c)) for c in cols)`
`img = tf.shade(aggs['a'])`
I get the following error:
> /home/nick.tomlinson/anaconda2/lib/python2.7/site-packages/datashader-0.4.0-py2.7.egg/datashader/glyphs.pyc in validate(self, in_dshape)
25 def validate(self, in_dshape):
26 if not isreal(in_dshape.measure[self.x]):
---> 27 raise ValueError('x must be real')
28 elif not isreal(in_dshape.measure[self.y]):
29 raise ValueError('y must be real')
ValueError: x must be real
'ts' in this case is a datetime64:
>
RangeIndex: 100000 entries, 0 to 99999
Data columns (total 12 columns):
Time 100000 non-null float64
a 100000 non-null float64
b 100000 non-null float64
c 100000 non-null float64
d 100000 non-null float64
e 100000 non-null float64
f 100000 non-null float64
g 100000 non-null float64
x 100000 non-null float64
y 100000 non-null float64
z 100000 non-null float64
ts 100000 non-null datetime64[ns]
dtypes: datetime64[ns](1), float64(11)
memory usage: 9.2 MB
Many thanks,
Nick
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the datetime64 example in examples/tseries.ipynb, especially plotting the ts column with cvs.line. Start from the validation path shown in glyphs.pyc and determine what is needed for datetime64 or pandas DatetimeIndexes to pass it. Done means the example plots ts without the “x must be real” error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100