Skip to content

Commit d10706f

Browse files
committed
Fixups
1 parent 34e8f03 commit d10706f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas/core/arrays/numpy_.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,9 @@ def _wrap_ndarray_result(self, result: np.ndarray):
571571

572572
def _formatter(self, boxed: bool = False) -> Callable[[Any], str | None]:
573573
# NEP 51: https://github.com/numpy/numpy/pull/22449
574-
if self.dtype == "object":
574+
if self.dtype.kind in "SU":
575+
return "'{}'".format
576+
elif self.dtype == "object":
575577
return repr
576578
else:
577579
return str

pandas/tests/arrays/numpy_/test_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def test_array_repr(any_numpy_array):
337337
values = "['a', 'b']"
338338
elif nparray.dtype == "float64":
339339
values = "[0.0, 1.0]"
340-
elif nparray.dtype == "int64":
340+
elif str(nparray.dtype).startswith("int"):
341341
values = "[0, 1]"
342342
elif nparray.dtype == "complex128":
343343
values = "[0j, (1+2j)]"

0 commit comments

Comments
 (0)