You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pandas/core/arrays/_arrow_string_mixins.py
-47
Original file line number
Diff line number
Diff line change
@@ -252,58 +252,11 @@ def _str_isalnum(self):
252
252
def_str_isalpha(self):
253
253
result=pc.utf8_is_alpha(self._pa_array)
254
254
returnself._convert_bool_result(result)
255
-
256
-
257
-
# def _str_isascii(self):
258
-
# if hasattr(pa.compute, "ascii_is_ascii"):
259
-
# # If PyArrow adds support in the future, use it
260
-
# return pa.compute.ascii_is_ascii(self._data)
261
-
# else:
262
-
# # Fallback: Use Python's native str.isascii() on each element
263
-
# return [
264
-
# s.isascii() if isinstance(s, str) else None
265
-
# for s in self.to_pylist()
266
-
# ]
267
-
268
-
# def _str_isascii(self):
269
-
# pylist = [
270
-
# s.isascii() if isinstance(s, str) else None
271
-
# for s in self._pa_array.to_pylist()
272
-
# ]
273
-
274
-
# result = pa.array(pylist, type=pa.bool_())
275
-
# return self._convert_bool_result(result)
276
-
277
-
# def _str_isascii(self):
278
-
# if isinstance(self, str):
279
-
# result = all(ord(char) < 128 for char in self)
280
-
# return self._convert_bool_result(result)
281
-
# return False
282
255
283
256
def_str_isascii(self):
284
-
# Check if the array is of string type (or if the implementation should handle it) # Apply the isascii check element-wise using PyArrow's compute functions
285
257
result=pc.string_is_ascii(self._pa_array)
286
-
287
-
# Convert the result to the appropriate format (e.g., PyArrow BooleanArray)
288
258
returnself._convert_bool_result(result)
289
259
290
-
# def _str_isascii(self):
291
-
# # Handle the case where self might be a pandas StringArray or similar
292
-
# # Check if each value is not NA, and is a string of length 1 (single character)
293
-
# def isna(value):
294
-
# return value is None
295
-
296
-
# def check_ascii(value):
297
-
# if isna(value):
298
-
# return False # Or return True depending on how you want to handle NA values
299
-
# if len(value) != 1:
300
-
# raise ValueError(f"Expected a string of length 1, got: {value}")
301
-
# return ord(value) < 128
302
-
303
-
# # Apply the check to each element in `self` (assuming `self` is iterable like pandas Series)
304
-
# result = all(check_ascii(char) for char in self)
0 commit comments