@@ -284,7 +284,7 @@ def dicts_to_array(dicts: list, columns: list):
284
284
else :
285
285
result[i, j] = onan
286
286
287
- return result.base # `.base` to access underlying np.ndarray
287
+ return np.asarray(result)
288
288
289
289
290
290
def fast_zip (list ndarrays ):
@@ -353,7 +353,7 @@ def get_reverse_indexer(int64_t[:] indexer, Py_ssize_t length):
353
353
if idx != - 1 :
354
354
rev_indexer[idx] = i
355
355
356
- return rev_indexer.base # `.base` to access underlying np.ndarray
356
+ return np.asarray(rev_indexer)
357
357
358
358
359
359
@ cython.wraparound (False )
@@ -534,7 +534,7 @@ def astype_unicode(arr: ndarray, skipna: bool=False) -> ndarray[object]:
534
534
535
535
result[i] = arr_i
536
536
537
- return result.base # `.base` to access underlying np.ndarray
537
+ return np.asarray(result)
538
538
539
539
540
540
@ cython.wraparound (False )
@@ -569,7 +569,7 @@ def astype_str(arr: ndarray, skipna: bool = False) -> ndarray[object]:
569
569
570
570
result[i] = arr_i
571
571
572
- return result.base # `.base` to access underlying np.ndarray
572
+ return np.asarray(result)
573
573
574
574
575
575
@ cython.wraparound (False )
@@ -695,7 +695,7 @@ def row_bool_subset(float64_t[:, :] values,
695
695
out[pos, j] = values[i, j]
696
696
pos += 1
697
697
698
- return out.base # `.base` to access underlying np.ndarray
698
+ return np.asarray(out)
699
699
700
700
701
701
@ cython.boundscheck (False )
@@ -717,7 +717,7 @@ def row_bool_subset_object(object[:, :] values,
717
717
out[pos, j] = values[i, j]
718
718
pos += 1
719
719
720
- return out.base # `.base` to access underlying np.ndarray
720
+ return np.asarray(out)
721
721
722
722
723
723
@ cython.boundscheck (False )
@@ -1941,8 +1941,7 @@ def maybe_convert_objects(object[:] objects, bint try_float=0,
1941
1941
1942
1942
if objects is None :
1943
1943
# Without explicitly raising, groupby.ops _aggregate_series_pure_python
1944
- # can pass None and incorrectly raise an AttributeError when trying
1945
- # to access `objects.base` below.
1944
+ # can pass None and end up returning np.array(None) below
1946
1945
raise TypeError
1947
1946
1948
1947
n = len (objects)
@@ -2053,7 +2052,7 @@ def maybe_convert_objects(object[:] objects, bint try_float=0,
2053
2052
if seen.datetimetz_:
2054
2053
if len ({getattr (val, ' tzinfo' , None ) for val in objects}) == 1 :
2055
2054
from pandas import DatetimeIndex
2056
- return DatetimeIndex(objects.base )
2055
+ return DatetimeIndex(np.asarray(objects) )
2057
2056
seen.object_ = 1
2058
2057
2059
2058
if not seen.object_:
@@ -2118,7 +2117,7 @@ def maybe_convert_objects(object[:] objects, bint try_float=0,
2118
2117
elif seen.is_bool:
2119
2118
return bools.view(np.bool_)
2120
2119
2121
- return objects.base # `.base` to access underlying np.ndarray
2120
+ return np.asarray(objects)
2122
2121
2123
2122
2124
2123
def map_infer_mask (ndarray arr , object f , uint8_t[:] mask , bint convert = 1 ):
@@ -2161,7 +2160,7 @@ def map_infer_mask(ndarray arr, object f, uint8_t[:] mask, bint convert=1):
2161
2160
convert_datetime = 0 ,
2162
2161
convert_timedelta = 0 )
2163
2162
2164
- return result.base # `.base` to access underlying np.ndarray
2163
+ return np.asarray(result)
2165
2164
2166
2165
2167
2166
@ cython.wraparound (False )
@@ -2203,7 +2202,7 @@ def map_infer(ndarray arr, object f, bint convert=1):
2203
2202
convert_datetime = 0 ,
2204
2203
convert_timedelta = 0 )
2205
2204
2206
- return result.base # `.base` to access underlying np.ndarray
2205
+ return np.asarray(result)
2207
2206
2208
2207
2209
2208
def to_object_array (rows: list , min_width: int = 0 ):
@@ -2245,7 +2244,7 @@ def to_object_array(rows: list, min_width: int = 0):
2245
2244
for j in range (len (row)):
2246
2245
result[i, j] = row[j]
2247
2246
2248
- return result.base # `.base` to access underlying np.ndarray
2247
+ return np.asarray(result)
2249
2248
2250
2249
2251
2250
def tuples_to_object_array (ndarray[object] tuples ):
@@ -2262,7 +2261,7 @@ def tuples_to_object_array(ndarray[object] tuples):
2262
2261
for j in range (k):
2263
2262
result[i, j] = tup[j]
2264
2263
2265
- return result.base # `.base` to access underlying np.ndarray
2264
+ return np.asarray(result)
2266
2265
2267
2266
2268
2267
def to_object_array_tuples (rows: list ):
@@ -2293,7 +2292,7 @@ def to_object_array_tuples(rows: list):
2293
2292
for j in range (len (row)):
2294
2293
result[i, j] = row[j]
2295
2294
2296
- return result.base # `.base` to access underlying np.ndarray
2295
+ return np.asarray(result)
2297
2296
2298
2297
2299
2298
@ cython.wraparound (False )
0 commit comments