| 702 | |
| 703 | @pytest.mark.pandas |
| 704 | def 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 |