MCPcopy Create free account
hub / github.com/apache/arrow / test_array_from_numpy_datetime

Function test_array_from_numpy_datetime

python/pyarrow/tests/test_array.py:2667–2681  ·  view source on GitHub ↗
(dtype, type)

Source from the content-addressed store, hash-verified

2665 ('datetime64[ns]', pa.timestamp('ns'))
2666])
2667def test_array_from_numpy_datetime(dtype, type):
2668 data = [
2669 None,
2670 datetime.datetime(2017, 4, 4, 12, 11, 10),
2671 datetime.datetime(2018, 1, 1, 0, 2, 0)
2672 ]
2673
2674 # from numpy array
2675 arr = pa.array(np.array(data, dtype=dtype))
2676 expected = pa.array(data, type=type)
2677 assert arr.equals(expected)
2678
2679 # from list of numpy scalars
2680 arr = pa.array(list(np.array(data, dtype=dtype)))
2681 assert arr.equals(expected)
2682
2683
2684@pytest.mark.numpy

Callers

nothing calls this directly

Calls 4

listFunction · 0.85
datetimeMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected