type_caster is not working for converting pandas.Timestamp to custom C++ chrono type #4469
Unanswered
steve-lorimer
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a python API that uses
asyncioto download a large quantity of data from a 3rd party vendor and delivers it to the caller in chunks:I want to wrap this API and expose it to C++. My idea is to pass a
std::functionbound to a callback, and call this for each chunk of dataThe
timeproduced in the python API is apandas.Timestamp.My company has a custom time class,
chrono::Time, which stores time as nanoseconds since the epoch.To enable conversion from
pandas.Timestamptochrono::Time, I have added the following specialisation:This, afaik, should allow me to do the following from C++:
The call to
downloadfails, however, with the following exception:The above specialisation for
chrono::Timeworks when passing from C++ to python (the type received in python ispandas.Timestamp), but it doesn't seem to be working for passingpandas.Timestampfrom python to C++.How can I enable the automatic conversion of a
pandas.Timestampto my customchrono::Timeclass when called from an embedded python script?Beta Was this translation helpful? Give feedback.
All reactions