Closed
Description
Describe the issue:
Similar to #26147 and #26317 it looks like np.where
should be doing a copy instead of a view for StringDType
.
Reproduce the code example:
import numpy as np
a = np.array(["a"*25, "b", np.nan], dtype=np.dtypes.StringDType(na_object=np.nan))
print(repr(np.where(a, a, a)))
Result:
# prints:
array(['', 'b', nan], dtype=StringDType(na_object=nan))
# should print:
array(['aaaaaaaaaaaaaaaaaaaaaaaaa', 'b', nan],
dtype=StringDType(na_object=nan))
Python and NumPy Versions:
Current main
branch, python 3.12.2.
Runtime Environment:
No response
Context for the issue:
No response