/usr/local/lib64/python3.6/site-packages/pandas/core/ops
NameSizeModeActions
__pycache__/-0755rm
array_ops.py154120644editdlrm
common.py16530644editdlrm
dispatch.py5490644editdlrm
docstrings.py180250644editdlrm
invalid.py12850644editdlrm
mask_ops.py49350644editdlrm
methods.py75940644editdlrm
missing.py51640644editdlrm
roperator.py10800644editdlrm
__init__.py213160644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/core/ops/invalid.py (1285B)
""" Templates for invalid operations. """ import operator import numpy as np def invalid_comparison(left, right, op): """ If a comparison has mismatched types and is not necessarily meaningful, follow python3 conventions by: - returning all-False for equality - returning all-True for inequality - raising TypeError otherwise Parameters ---------- left : array-like right : scalar, array-like op : operator.{eq, ne, lt, le, gt} Raises ------ TypeError : on inequality comparisons """ if op is operator.eq: res_values = np.zeros(left.shape, dtype=bool) elif op is operator.ne: res_values = np.ones(left.shape, dtype=bool) else: typ = type(right).__name__ raise TypeError(f"Invalid comparison between dtype={left.dtype} and {typ}") return res_values def make_invalid_op(name: str): """ Return a binary method that always raises a TypeError. Parameters ---------- name : str Returns ------- invalid_op : function """ def invalid_op(self, other=None): typ = type(self).__name__ raise TypeError(f"cannot perform {name} with this index type: {typ}") invalid_op.__name__ = name return invalid_op