[
https://issues.apache.org/jira/browse/ARROW-1963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16360926#comment-16360926
]
Antoine Pitrou commented on ARROW-1963:
---------------------------------------
Can you qualify what is desired here? Currently we have the following:
{code:python}
>>> a = np.array(['2001', '2002', '2003'], dtype='M8[ms]')
>>> a
array(['2001-01-01T00:00:00.000', '2002-01-01T00:00:00.000',
'2003-01-01T00:00:00.000'], dtype='datetime64[ms]')
>>> pa.array(a)
<pyarrow.lib.TimestampArray object at 0x7f72e90ad5e8>
[
Timestamp('2001-01-01 00:00:00'),
Timestamp('2002-01-01 00:00:00'),
Timestamp('2003-01-01 00:00:00')
]
{code}
and also:
{code:python}
>>> pa.array(list(a), type=pa.timestamp('ms'))
<pyarrow.lib.TimestampArray object at 0x7f72e9141818>
[
Timestamp('2001-01-01 00:00:00'),
Timestamp('2002-01-01 00:00:00'),
Timestamp('2003-01-01 00:00:00')
]
{code}
but not:
{code}
>>> pa.array(list(a))
Traceback (most recent call last):
File "<ipython-input-70-bca21b085475>", line 1, in <module>
pa.array(list(a))
File "array.pxi", line 181, in pyarrow.lib.array
File "array.pxi", line 26, in pyarrow.lib._sequence_to_array
File "error.pxi", line 85, in pyarrow.lib.check_status
ArrowNotImplementedError:
/home/antoine/arrow/cpp/src/arrow/python/builtin_convert.cc:983 code:
AppendPySequence(seq, size, real_type, builder.get())
/home/antoine/arrow/cpp/src/arrow/python/builtin_convert.cc:406 code:
static_cast<Derived*>(this)->AppendSingle(ref.obj())
Cannot convert NumPy datetime64 objects with differing unit
{code}
> Python: Create Array from sequence of numpy.datetime64
> ------------------------------------------------------
>
> Key: ARROW-1963
> URL: https://issues.apache.org/jira/browse/ARROW-1963
> Project: Apache Arrow
> Issue Type: Improvement
> Components: Python
> Affects Versions: 0.8.0
> Reporter: Uwe L. Korn
> Priority: Major
> Fix For: 0.9.0
>
>
> Currently we only support {{datetime.datetime}} and {{datetime.date}} but
> {{numpy.datetime64}} also occurs quite often in the numpy/pandas-related
> world.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)