@@ -156,10 +156,15 @@ def _to_numpy(data: Any) -> np.ndarray:
156156 array
157157 The C contiguous NumPy array.
158158 """
159- # Mapping of unsupported dtypes to the expected NumPy dtype.
160- dtypes : dict [str , str | type ] = {
161- "date32[day][pyarrow]" : "datetime64[D]" ,
162- "date64[ms][pyarrow]" : "datetime64[ms]" ,
159+ # Mapping of unsupported dtypes to expected NumPy dtypes.
160+ dtypes : dict [str , type | str ] = {
161+ # For string dtypes.
162+ "large_string" : np .str_ , # pa.large_string and pa.large_utf8
163+ "string" : np .str_ , # pa.string and pa.utf8
164+ "string_view" : np .str_ , # pa.string_view
165+ # For datetime dtypes.
166+ "date32[day][pyarrow]" : np .datetime64 ,
167+ "date64[ms][pyarrow]" : np .datetime64 ,
163168 }
164169
165170 if (
@@ -173,7 +178,7 @@ def _to_numpy(data: Any) -> np.ndarray:
173178 # we can remove the workaround in PyGMT v0.17.0.
174179 array = np .ascontiguousarray (data .astype (float ))
175180 else :
176- vec_dtype = str (getattr (data , "dtype" , "" ))
181+ vec_dtype = str (getattr (data , "dtype" , getattr ( data , "type" , "" ) ))
177182 array = np .ascontiguousarray (data , dtype = dtypes .get (vec_dtype ))
178183 return array
179184
0 commit comments