We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0105d64 commit 3ad0c86Copy full SHA for 3ad0c86
pygmt/clib/conversion.py
@@ -306,12 +306,7 @@ def strings_to_ctypes_array(strings: StringArrayTypes) -> ctp.Array:
306
>>> [s.decode() for s in ctypes_array]
307
['first', 'second', 'third']
308
"""
309
- try:
310
- bytes_string_list = [s.encode() for s in strings]
311
- except AttributeError: # 'pyarrow.StringScalar' object has no attribute 'encode'
312
- # Convert pyarrow.StringArray to Python list first
313
- bytes_string_list = [s.encode() for s in strings.to_pylist()] # type: ignore[union-attr]
314
- return (ctp.c_char_p * len(strings))(*bytes_string_list)
+ return (ctp.c_char_p * len(strings))(*[s.encode() for s in np.asarray(strings)])
315
316
317
def array_to_datetime(array):
0 commit comments