o
    tBh                     @   sL   d dl Zd dlmZ d dlmZ ddlmZ ddl	m
Z
 dd Zd	d
 ZdS )    N)sparse)suppress   )is_scalar_nan)_object_dtype_isnanc                 C   s   t tt dd l}||ju r|| W  d    S W d    n1 s%w   Y  t|rQ| jjdkr;t	
| }|S | jjdv rKt	j| jtd}|S t| }|S | |k}|S )Nr   f)iu)dtype)r   ImportErrorAttributeErrorpandasNAisnar   r
   kindnpisnanzerosshapeboolr   )Xvalue_to_maskr   Xt r   j/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/sklearn/utils/_mask.py_get_dense_mask	   s$   


r   c                 C   s\   t | s
t| |S t| j|}| jdkrt jnt j}||| j | j	 f| j
td}|S )a  Compute the boolean mask X == value_to_mask.

    Parameters
    ----------
    X : {ndarray, sparse matrix} of shape (n_samples, n_features)
        Input data, where ``n_samples`` is the number of samples and
        ``n_features`` is the number of features.

    value_to_mask : {int, float}
        The value which is to be masked in X.

    Returns
    -------
    X_mask : {ndarray, sparse matrix} of shape (n_samples, n_features)
        Missing mask.
    csr)r   r
   )spissparser   dataformat
csr_matrix
csc_matrixindicescopyindptrr   r   )r   r   r   sparse_constructor	Xt_sparser   r   r   	_get_mask!   s   

r(   )numpyr   scipyr   r   
contextlibr    r   fixesr   r   r(   r   r   r   r   <module>   s    