#StackBounty: #python #numba Create Array of Dates in Numba?

Bounty: 50

I would like to create an array of dates in a Numba function, running in nopython mode.

I can’t see a date type, so I am trying NPDatetime.

My attempted code is:

import numba as nb
import numpy as np


@nb.jit(nopython=True)
def xxx():
    return np.empty(10, dtype=nb.types.NPDatetime('D'))


print(xxx())

However, the code returns this error:

Unknown attribute 'NPDatetime' of type Module(<module 'numba.types' from '/home/xxx/anaconda3/lib/python3.6/site-packages/numba/types/__init__.py'>)

My numba version is 0.39.0


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.