Sindbad~EG File Manager
�
Mٜg � �F � d Z ddlmZ ddlZddlZddlmZ dd�Zd d�Z d� Z
y)
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).
� )�annotationsN)� roperatorc � � | j j dk( r| S t |d� }t |t j
� }|s|s| S |rt j |� }|j j dv rf|dk( }|j � rQ|t j | � z }| j dd�� } t j | |t j � | 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.
�f�dtype�iur �float64F��copy)r �kind�hasattr�
isinstance�np�ndarray�array�any�isnan�astype�putmask�nan)�result�x�y�is_variable_type�is_scalar_type�ymask�masks �B/usr/local/lib/python3.12/site-packages/pandas/core/ops/missing.py�_fill_zerosr ! s� � � �|�|���C���
��q�'�*��#�A�r�z�z�2�2�N��N��
���H�H�Q�K���w�w�|�|�t���Q����9�9�;��B�H�H�V�,�,�,�D� �]�]�9�5�]�9�F��J�J�v�t�R�V�V�,��M� c �: � t |d� st j |� }t | d� st j | � } |dk( }|j � r�|t j |� z }|| z }| dk }| dkD }|| dk( z }||z ||z z } ||z ||z z }
|j � s | j � s|
j � rM|j dd�� }t j ||<