@@ -97,7 +97,7 @@ template <typename T> class PandasVector {
97
97
}
98
98
99
99
auto ToNdArray () -> nb::object {
100
- const auto ndarray = nb::ndarray<nb::numpy, const T, nb::ndim<1 >>(
100
+ const auto ndarray = nb::ndarray<nb::numpy, T, nb::ndim<1 >>(
101
101
vec_.data (), {vec_.size ()});
102
102
103
103
external_view_exists_ = true ;
@@ -236,8 +236,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
236
236
}
237
237
}
238
238
239
- auto Lookup (const nb::ndarray<const T, nb::ndim<1 >> &values, nb::object mask)
240
- -> nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1>> {
239
+ auto Lookup (const nb::ndarray<const T, nb::ndim<1 >> &values, nb::object mask) {
241
240
if constexpr (IsMasked) {
242
241
if (mask.is_none ()) {
243
242
throw std::invalid_argument (" mask must not be None!" );
@@ -284,7 +283,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
284
283
nb::capsule owner (locs, [](void *p) noexcept { delete[] (size_t *) p; });
285
284
286
285
const size_t shape[1 ] = {n};
287
- return nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1 >>(locs, 1 , shape,
286
+ return nb::ndarray<nb::numpy, Py_ssize_t, nb::ndim<1 >>(locs, 1 , shape,
288
287
owner);
289
288
}
290
289
@@ -318,10 +317,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
318
317
return tup[1 ];
319
318
}
320
319
321
- auto GetLabelsGroupby (const nb::ndarray<const T, nb::ndim<1 >> &values)
322
- -> std::tuple<nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1>>,
323
- nb::object> {
324
-
320
+ auto GetLabelsGroupby (const nb::ndarray<const T, nb::ndim<1 >> &values) {
325
321
nb::call_guard<nb::gil_scoped_release>();
326
322
const auto values_v = values.view ();
327
323
const auto n = values.shape (0 );
@@ -356,7 +352,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
356
352
const size_t shape[1 ] = {n};
357
353
nb::capsule owner (labels, [](void *p) noexcept { delete[] (size_t *) p; });
358
354
const auto labels_arr =
359
- nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1 >>(labels, 1 , shape,
355
+ nb::ndarray<nb::numpy, Py_ssize_t, nb::ndim<1 >>(labels, 1 , shape,
360
356
owner);
361
357
return std::make_tuple (labels_arr, uniques.ToNdArray ());
362
358
}
@@ -378,7 +374,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
378
374
const auto na_val = use_na_value ? nb::cast<T>(na_value) : T ();
379
375
380
376
if (return_inverse) { // this is really factorize
381
- nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1 >> labels;
377
+ nb::ndarray<nb::numpy, Py_ssize_t, nb::ndim<1 >> labels;
382
378
if (ignore_na) {
383
379
if (use_na_value) {
384
380
labels = UniqueWithInverse<true , true >(values, uniques, count_prior,
@@ -442,7 +438,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
442
438
[[maybe_unused]] Py_ssize_t na_sentinel,
443
439
[[maybe_unused]] T na_value,
444
440
[[maybe_unused]] nb::object mask_obj = nb::none())
445
- -> nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1>> {
441
+ -> nb::ndarray<nb::numpy, Py_ssize_t, nb::ndim<1>> {
446
442
if constexpr (IsMasked) {
447
443
if (mask_obj.is_none ()) {
448
444
throw std::invalid_argument (" mask must not be None!" );
@@ -523,7 +519,7 @@ template <typename T, bool IsMasked> class PandasHashTable {
523
519
524
520
const size_t shape[1 ] = {n};
525
521
nb::capsule owner (labels, [](void *p) noexcept { delete[] (size_t *) p; });
526
- return nb::ndarray<nb::numpy, const Py_ssize_t, nb::ndim<1 >>(labels, 1 ,
522
+ return nb::ndarray<nb::numpy, Py_ssize_t, nb::ndim<1 >>(labels, 1 ,
527
523
shape, owner);
528
524
}
529
525
0 commit comments