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

Function test_sequence_numpy_double

python/pyarrow/tests/test_convert_builtin.py:633–653  ·  view source on GitHub ↗
(seq, np_str_scalar, pa_type, from_pandas)

Source from the content-addressed store, hash-verified

631])
632@pytest.mark.parametrize("from_pandas", [True, False])
633def test_sequence_numpy_double(seq, np_str_scalar, pa_type, from_pandas):
634 np_scalar = getattr(np, np_str_scalar)
635 data = [np_scalar(1.5), np_scalar(1), None, np_scalar(2.5), None, np.nan]
636 arr = pa.array(seq(data), from_pandas=from_pandas)
637 assert len(arr) == 6
638 if from_pandas:
639 assert arr.null_count == 3
640 else:
641 assert arr.null_count == 2
642 if from_pandas:
643 # The NaN is skipped in type inference, otherwise it forces a
644 # float64 promotion
645 assert arr.type == pa_type
646 else:
647 assert arr.type == pa.float64()
648
649 assert arr.to_pylist()[:4] == data[:4]
650 if from_pandas:
651 assert arr.to_pylist()[5] is None
652 else:
653 assert np.isnan(arr.to_pylist()[5])
654
655
656@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

lenFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected