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

Method test_non_natural_stride

python/pyarrow/tests/test_pandas.py:3273–3284  ·  view source on GitHub ↗

ARROW-2172: converting from a Numpy array with a stride that's not a multiple of itemsize.

(self)

Source from the content-addressed store, hash-verified

3271 tm.assert_series_equal(arr.to_pandas(), empty_objects)
3272
3273 def test_non_natural_stride(self):
3274 """
3275 ARROW-2172: converting from a Numpy array with a stride that's
3276 not a multiple of itemsize.
3277 """
3278 dtype = np.dtype([('x', np.int32), ('y', np.int16)])
3279 data = np.array([(42, -1), (-43, 2)], dtype=dtype)
3280 assert data.strides == (6,)
3281 arr = pa.array(data['x'], type=pa.int32())
3282 assert arr.to_pylist() == [42, -43]
3283 arr = pa.array(data['y'], type=pa.int16())
3284 assert arr.to_pylist() == [-1, 2]
3285
3286 def test_array_from_strided_numpy_array(self):
3287 # ARROW-5651

Callers

nothing calls this directly

Calls 2

dtypeMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected