edgarrmondragon commented on code in PR #1027:
URL: https://github.com/apache/arrow-nanoarrow/pull/1027#discussion_r4634458582
##########
python/src/nanoarrow/c_array.py:
##########
@@ -558,6 +567,21 @@ def _append_using_array(self, obj: Iterable) -> None:
self._c_builder.set_null_count(0)
self._c_builder.set_offset(0)
+ def _convert_dates(self, obj: Iterable) -> Iterable:
+ from datetime import date, datetime
+
+ epoch_ordinal = date(1970, 1, 1).toordinal()
+ scale = 1 if self._schema_view.type_id == _types.DATE32 else 86_400_000
+
+ for item in obj:
+ if isinstance(item, datetime):
+ msg = f"Can't convert datetime.datetime to
{self._schema_view.type}; use .date() to convert it to a datetime.date first"
+ raise TypeError(msg)
Review Comment:
I'm unsure about this. PyArrow does accept `datetime.datetime` but truncates
the time of day with `value -= value % 8640000`:
https://github.com/apache/arrow/blob/931b9cccda5de68d48201dc2db50b6b6a9a72741/python/pyarrow/src/arrow/python/python_to_arrow.cc#L309-L314
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]