I have an array of ethereum addresses in hexadecimal format (20 bytes), encoded as an hexadecimal string. How can I transform that into a FixedSizeBinaryArray?
I tried using cast:
<code>>>> import pyarrow as pa
>>> a = pa.array([
'0x42',
'0x6e',
'0x37',
])
>>> a.cast(pa.binary())
<pyarrow.lib.BinaryArray object at 0x7f937829e200>
[
30783432,
30783738,
30783337
]
</code>
<code>>>> import pyarrow as pa
>>> a = pa.array([
'0x42',
'0x6e',
'0x37',
])
>>> a.cast(pa.binary())
<pyarrow.lib.BinaryArray object at 0x7f937829e200>
[
30783432,
30783738,
30783337
]
</code>
>>> import pyarrow as pa
>>> a = pa.array([
'0x42',
'0x6e',
'0x37',
])
>>> a.cast(pa.binary())
<pyarrow.lib.BinaryArray object at 0x7f937829e200>
[
30783432,
30783738,
30783337
]
But, as expected, the results are not what I want. In my case the new array should have 66, then 110, then 55.
I can’t convert to int and then to bytes because it doesn’t fit in 64bits (nor decimal’s 128 bits).