(uint, int, float, np_float_str)
| 121 | ] |
| 122 | ) |
| 123 | def test_pandas_roundtrip(uint, int, float, np_float_str): |
| 124 | arr = [1, 2, 3] |
| 125 | table = pa.table( |
| 126 | { |
| 127 | "a": pa.array(arr, type=uint), |
| 128 | "b": pa.array(arr, type=int), |
| 129 | "c": pa.array(np.array(arr, dtype=np.dtype(np_float_str)), type=float), |
| 130 | "d": [True, False, True], |
| 131 | } |
| 132 | ) |
| 133 | from pandas.api.interchange import ( |
| 134 | from_dataframe as pandas_from_dataframe |
| 135 | ) |
| 136 | pandas_df = pandas_from_dataframe(table) |
| 137 | result = pi.from_dataframe(pandas_df) |
| 138 | assert table.equals(result) |
| 139 | |
| 140 | table_protocol = table.__dataframe__() |
| 141 | result_protocol = result.__dataframe__() |
| 142 | |
| 143 | assert table_protocol.num_columns() == result_protocol.num_columns() |
| 144 | assert table_protocol.num_rows() == result_protocol.num_rows() |
| 145 | assert table_protocol.num_chunks() == result_protocol.num_chunks() |
| 146 | assert table_protocol.column_names() == result_protocol.column_names() |
| 147 | |
| 148 | |
| 149 | @pytest.mark.pandas |
nothing calls this directly
no test coverage detected