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

Function test_integer_with_nulls

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

Source from the content-addressed store, hash-verified

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