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

Function test_schema_from_pandas

python/pyarrow/tests/test_schema.py:704–721  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

702
703@pytest.mark.pandas
704def test_schema_from_pandas():
705 import pandas as pd
706 inputs = [
707 list(range(10)),
708 pd.Categorical(list(range(10))),
709 ['foo', 'bar', None, 'baz', 'qux'],
710 np.array([
711 '2007-07-13T01:23:34.123456789',
712 '2006-01-13T12:34:56.432539784',
713 '2010-08-13T05:46:57.437699912'
714 ], dtype='datetime64[ns]'),
715 pd.array([1, 2, None], dtype=pd.Int32Dtype()),
716 ]
717 for data in inputs:
718 df = pd.DataFrame({'a': data}, index=data)
719 schema = pa.Schema.from_pandas(df)
720 expected = pa.Table.from_pandas(df).schema
721 assert schema == expected
722
723
724@pytest.mark.pandas

Callers

nothing calls this directly

Calls 2

listFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected