pybind / pybind/pybind11

I am not able to get uint64_t* for np.datetime64

Open
#1,970 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

the error: "cannot convert value dtype('<M8[ns]') to dtype(uint64t)"

code example:

auto arr_value = py::cast<py::array_t<std::uint64_t, py::array::c_style>>(df["datetime_column].attr("to_numpy")());
std::uint64_t* pointer = static_cast<std::uint64_t*>(arr_value);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the py::cast<py::array_t<std::uint64_t, py::array::c_style>> expression and trace pybind11's NumPy array conversion for np.datetime64 values. Determine whether the conversion should support this dtype and verify that the resulting array can provide the requested uint64_t pointer.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, numpy, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.