Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pandas/core/ops/__pycache__/missing.cpython-37.pyc
Назад
B �5�gB � @ sP d Z ddlZddlZddlmZmZmZ ddlm Z dd� Z dd� Zd d � ZdS )aP Missing data handling for arithmetic operations. In particular, pandas conventions regarding division by zero differ from numpy in the following ways: 1) np.array([-1, 0, 1], dtype=dtype1) // np.array([0, 0, 0], dtype=dtype2) gives [nan, nan, nan] for most dtype combinations, and [0, 0, 0] for the remaining pairs (the remaining being dtype1==dtype2==intN and dtype==dtype2==uintN). pandas convention is to return [-inf, nan, inf] for all dtype combinations. Note: the numpy behavior described here is py3-specific. 2) np.array([-1, 0, 1], dtype=dtype1) % np.array([0, 0, 0], dtype=dtype2) gives precisely the same results as the // operation. pandas convention is to return [nan, nan, nan] for all dtype combinations. 3) divmod behavior consistent with 1) and 2). � N)�is_float_dtype�is_integer_dtype� is_scalar)� roperatorc C s� t | j�r| S t|d�p t|d�}t|�}|s6|s6| S |rDt�|�}t|j�r�|dk�� r�|dkt�| � @ � � }| j }| jddd�� � } t�| |tj � | �|�} | S )z� If this is a reversed op, then flip x,y If we have an integer value (or array in y) and we have 0's, fill them with np.nan, return the result. Mask the nan's from x. �dtype�typer �float64F)�copy)r r �hasattrr �np�arrayr �any�isnanZravel�shape�astypeZputmask�nanZreshape)�result�x�yZis_variable_typeZis_scalar_type�maskr � r �M/home/digitalm-up/venv/lib/python3.7/site-packages/pandas/core/ops/missing.py� fill_zeros% s r c C s� t |tj�s|S t|�r"t�|�}|dk}t |t�r8|S |�� r�|t�|�@ }|| @ }|| dk@ }tjdd��6 || dk @ || dk@ B }|| dk@ || dk @ B }W dQ R X |�� s�|�� s�|�� r�|j ddd�}tj ||<