Conversion between std::chrono and numpy.datetime64
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Using #include <pybind11/chrono.h> we can define
def(py::init([](const std::chrono::system_clock::time_point& obj)
so that we can convert between std::chrono and python's datetime.
Is there a similar concept for conversions between std::chrono and numpy's datetime64? I had a look at pybind11/numpy.h but couldn't find anything.
I am happy implement it and submit a PR, if someone could point me in the right direction for how to do it. Many thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the existing conversion approach in pybind11/chrono.h with the NumPy-related facilities in pybind11/numpy.h. Determine the expected conversion behavior between std::chrono and numpy.datetime64, then confirm that the resulting implementation supports the requested conversion in the relevant binding definitions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, numpy, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100