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

Function test_integer_with_nulls

python/pyarrow/tests/test_feather.py:299–323  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

297
298@pytest.mark.pandas
299def test_integer_with_nulls(version):
300 # pandas requires upcast to float dtype
301 path = random_path()
302 TEST_FILES.append(path)
303
304 int_dtypes = ['i1', 'i2', 'i4', 'i8', 'u1', 'u2', 'u4', 'u8']
305 num_values = 100
306
307 arrays = []
308 null_mask = np.random.randint(0, 10, size=num_values) < 3
309 expected_cols = []
310 for name in int_dtypes:
311 values = np.random.randint(0, 100, size=num_values)
312 arrays.append(pa.array(values, mask=null_mask))
313
314 expected = values.astype('f8')
315 expected[null_mask] = np.nan
316
317 expected_cols.append(expected)
318
319 table = pa.table(arrays, names=int_dtypes)
320 _check_arrow_roundtrip(table)
321
322 df = table.to_pandas()
323 _check_pandas_roundtrip(df, version=version)
324
325
326@pytest.mark.pandas

Callers

nothing calls this directly

Calls 5

random_pathFunction · 0.85
_check_arrow_roundtripFunction · 0.85
_check_pandas_roundtripFunction · 0.70
appendMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected