| 3291 | pa_arr.equals(expected) |
| 3292 | |
| 3293 | def test_safe_unsafe_casts(self): |
| 3294 | # ARROW-2799 |
| 3295 | df = pd.DataFrame({ |
| 3296 | 'A': list('abc'), |
| 3297 | 'B': np.linspace(0, 1, 3) |
| 3298 | }) |
| 3299 | |
| 3300 | schema = pa.schema([ |
| 3301 | pa.field('A', pa.string()), |
| 3302 | pa.field('B', pa.int32()) |
| 3303 | ]) |
| 3304 | |
| 3305 | with pytest.raises(ValueError): |
| 3306 | pa.Table.from_pandas(df, schema=schema) |
| 3307 | |
| 3308 | table = pa.Table.from_pandas(df, schema=schema, safe=False) |
| 3309 | assert table.column('B').type == pa.int32() |
| 3310 | |
| 3311 | def test_error_sparse(self): |
| 3312 | # ARROW-2818 |