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

Method test_list_metadata

python/pyarrow/tests/test_pandas.py:613–621  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

611 tm.assert_frame_equal(result, expected)
612
613 def test_list_metadata(self):
614 df = pd.DataFrame({'data': [[1], [2, 3, 4], [5] * 7]})
615 schema = pa.schema([pa.field('data', type=pa.list_(pa.int64()))])
616 table = pa.Table.from_pandas(df, schema=schema)
617 js = table.schema.pandas_metadata
618 assert 'mixed' not in js
619 data_column = js['columns'][0]
620 assert data_column['pandas_type'] == 'list[int64]'
621 assert data_column['numpy_type'] == 'object'
622
623 def test_struct_metadata(self):
624 df = pd.DataFrame({'dicts': [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]})

Callers

nothing calls this directly

Calls 2

schemaMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected