You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ARROW-1156: [C++/Python] Expand casting API, add UnaryKernel callable. Use Cast in appropriate places when converting from pandas
cc @cloud-fan
With this patch we now try to cast to indicated type on ingest of objects from pandas:
```
In [3]: arr = np.array([None] * 5)
In [4]: pa.Array.from_pandas(arr)
Out[4]:
<pyarrow.lib.NullArray object at 0x7f6cf1485d18>
[
NA,
NA,
NA,
NA,
NA
]
In [5]: pa.Array.from_pandas(arr, type=pa.int32())
Out[5]:
<pyarrow.lib.Int32Array object at 0x7f6cf1485d68>
[
NA,
NA,
NA,
NA,
NA
]
```
I also added zero-copy casts from integers of the right size to each of the date and time types.
Includes refactoring for ARROW-1481.
Author: Wes McKinney <wes.mckinney@twosigma.com>
Closesapache#1063 from wesm/ARROW-1156 and squashes the following commits:
166d1a5 [Wes McKinney] iwyu
34f5c9d [Wes McKinney] Harden default cast options, fix unsafe Python case
1d07b75 [Wes McKinney] Add some basic casting unit tests in Python
c1b4570 [Wes McKinney] Expose arrow::compute::Cast in Python as Array.cast. Still need to write tests
a9a04c9 [Wes McKinney] UnaryKernel::Call returns Status for now for simplicity. Support pre-allocated memory
8903709 [Wes McKinney] Implement casts from null to numbers. Try to cast for types where we do not have an inference rule when converting from arrays of Python objects
a22dd20 [Wes McKinney] Add test to assert zero copy for compatible integer to date/time
a14b83f [Wes McKinney] Create callable CastKernel object. Add zero-copy cast rules for date/time types
0 commit comments