Skip to content

Commit

Permalink
Assorted fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Nov 27, 2024
1 parent 0f586a2 commit 401e42f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pandas/_libs/index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ cdef class IndexEngine:

cdef readonly:
ndarray values
ndarray mask
object mask
HashTable mapping
bint over_size_threshold

Expand Down
3 changes: 3 additions & 0 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import warnings

import numpy as np
from pandas_mask import PandasMaskArray

from pandas._libs import (
algos,
Expand Down Expand Up @@ -1173,6 +1174,8 @@ def take(
... )
array([ 10, 10, -10])
"""
if isinstance(arr, PandasMaskArray): # TODO: implement take directly on mask
arr = np.array(arr)
if not isinstance(
arr,
(np.ndarray, ABCExtensionArray, ABCIndex, ABCSeries, ABCNumpyExtensionArray),
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _cython_op_ndim_compat(
# expand to 2d, dispatch, then squeeze if appropriate
values2d = values[None, :]
if mask is not None:
mask = mask[None, :]
mask = np.array(mask)[None, :]
if result_mask is not None:
result_mask = result_mask[None, :]
res = self._call_cython_op(
Expand Down

0 comments on commit 401e42f

Please sign in to comment.