I want a result such as below by using pyarrow:
[
{'value': 'bar', 'key': 'foo'},
{'value': 'bar', 'key': 'foo'},
{'value': 'bar', 'key': 'foo'}
]
Therefore I wrote the following code:
import pyarrow as pa
fields = [pa.array(['foo', 'foo', 'foo']), pa.array(['bar', 'bar', 'bar'])]
arr = pa.StructArray.from_arrays(['key', 'value'], fields)
print(arr)
But I get the following error that is related to "arr = pa.StructArray.from_arrays(['key', 'value'], fields)":
expected bytes, pyarrow.lib.StringArray found
why? How can I fix it?