Thanks Wes!
On Mon, Dec 18, 2017 at 6:25 PM, Wes McKinney wrote:
> hi Li,
>
> You want to use StructArray.from_arrays
>
> a_values = pa.array([1])
> b_values = pa.array([2])
> struct_values = pa.StructArray.from_arrays(['a', 'b'], [a_values,
> b_values])
>
> In [4]: struct_values
> Out[4]:
>
>
hi Li,
You want to use StructArray.from_arrays
a_values = pa.array([1])
b_values = pa.array([2])
struct_values = pa.StructArray.from_arrays(['a', 'b'], [a_values, b_values])
In [4]: struct_values
Out[4]:
[
{'b': 2, 'a': 1}
]
You can find other examples in the Python test suite. I would be ve
Also tried this:
>>> pa.array([{'a': 1.0, 'b': 2.0}], pa.struct([pa.field('a',
pa.float64()), pa.field('b', pa.float64())]))
Traceback (most recent call last):
File "", line 1, in
File "array.pxi", line 56, in pyarrow.lib.array
File "error.pxi", line 85, in pyarrow.lib.check_status
pya
Hey folks,
What's best way to create a pyarrow.Array of struct? I tried to create a
pyarrow.Array from a pd.Series of dict but doesn't seem to work (0.7.1):
>>> s
0{'a': 1, 'b': 2}
Name: stats, dtype: object
>>> pa.Array.from_pandas(s)
Traceback (most recent call last):
File "", line 1