core.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:radar 作者: amoose136 项目源码 文件源码
def take(self, indices, axis=None, out=None, mode='raise'):
        """
        """
        (_data, _mask) = (self._data, self._mask)
        cls = type(self)
        # Make sure the indices are not masked
        maskindices = getattr(indices, '_mask', nomask)
        if maskindices is not nomask:
            indices = indices.filled(0)
        # Get the data
        if out is None:
            out = _data.take(indices, axis=axis, mode=mode).view(cls)
        else:
            np.take(_data, indices, axis=axis, mode=mode, out=out)
        # Get the mask
        if isinstance(out, MaskedArray):
            if _mask is nomask:
                outmask = maskindices
            else:
                outmask = _mask.take(indices, axis=axis, mode=mode)
                outmask |= maskindices
            out.__setmask__(outmask)
        return out

    # Array methods
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号