Exemple #1
0
Attributes
----------
None

Methods
-------
None
"""

# create the Dtype
Int8Dtype = register_extension_dtype(
    type(
        "Int8Dtype",
        (_IntegerDtype,),
        {
            "type": np.int8,
            "name": "Int8",
            "__doc__": _dtype_docstring.format(dtype="int8"),
        },
    )
)

Int16Dtype = register_extension_dtype(
    type(
        "Int16Dtype",
        (_IntegerDtype,),
        {
            "type": np.int16,
            "name": "Int16",
            "__doc__": _dtype_docstring.format(dtype="int16"),
        },
Exemple #2
0
An ExtensionDtype for {dtype} integer data.

Attributes
----------
None

Methods
-------
None
"""

# create the Dtype
Int8Dtype = register_extension_dtype(
    type('Int8Dtype', (_IntegerDtype, ), {
        'type': np.int8,
        'name': 'Int8',
        '__doc__': _dtype_docstring.format(dtype='int8')
    })
)

Int16Dtype = register_extension_dtype(
    type('Int16Dtype', (_IntegerDtype, ), {
        'type': np.int16,
        'name': 'Int16',
        '__doc__': _dtype_docstring.format(dtype='int16')
    })
)

Int32Dtype = register_extension_dtype(
    type('Int32Dtype', (_IntegerDtype, ), {
        'type': np.int32,
Exemple #3
0
            return self._maybe_mask_result(result, mask, other, op_name)

        name = '__{name}__'.format(name=op.__name__)
        return set_function_name(integer_arithmetic_method, name, cls)


IntegerArray._add_arithmetic_ops()
IntegerArray._add_comparison_ops()

module = sys.modules[__name__]

# create the Dtype
_dtypes = {}
for dtype in [
        'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32',
        'uint64'
]:

    if dtype.startswith('u'):
        name = "U{}".format(dtype[1:].capitalize())
    else:
        name = dtype.capitalize()
    classname = "{}Dtype".format(name)
    attributes_dict = {'type': getattr(np, dtype), 'name': name}
    dtype_type = register_extension_dtype(
        type(classname, (_IntegerDtype, ), attributes_dict))
    setattr(module, classname, dtype_type)

    _dtypes[dtype] = dtype_type()
Exemple #4
0
An ExtensionDtype for {dtype} integer data.

Attributes
----------
None

Methods
-------
None
"""

# create the Dtype
Int8Dtype = register_extension_dtype(
    type('Int8Dtype', (_IntegerDtype, ), {
        'type': np.int8,
        'name': 'Int8',
        '__doc__': _dtype_docstring.format(dtype='int8')
    })
)

Int16Dtype = register_extension_dtype(
    type('Int16Dtype', (_IntegerDtype, ), {
        'type': np.int16,
        'name': 'Int16',
        '__doc__': _dtype_docstring.format(dtype='int16')
    })
)

Int32Dtype = register_extension_dtype(
    type('Int32Dtype', (_IntegerDtype, ), {
        'type': np.int32,
Exemple #5
0
        name = '__{name}__'.format(name=op.__name__)
        return set_function_name(integer_arithmetic_method, name, cls)


IntegerArray._add_arithmetic_ops()
IntegerArray._add_comparison_ops()


module = sys.modules[__name__]


# create the Dtype
_dtypes = {}
for dtype in ['int8', 'int16', 'int32', 'int64',
              'uint8', 'uint16', 'uint32', 'uint64']:

    if dtype.startswith('u'):
        name = "U{}".format(dtype[1:].capitalize())
    else:
        name = dtype.capitalize()
    classname = "{}Dtype".format(name)
    attributes_dict = {'type': getattr(np, dtype),
                       'name': name}
    dtype_type = register_extension_dtype(
        type(classname, (_IntegerDtype, ), attributes_dict)
    )
    setattr(module, classname, dtype_type)

    _dtypes[dtype] = dtype_type()
Exemple #6
0
BoolArray._add_arithmetic_ops()
BoolArray._add_comparison_ops()


_dtype_docstring = """
An ExtensionDtype for {dtype} data.

Attributes
----------
None

Methods
-------
None
"""

# create the Dtype
BoolDtype = register_extension_dtype(
    type(
        "BoolDtype",
        (_BoolDtype,),
        {
            "type": np.bool,
            "name": "Bool",
            "__doc__": _dtype_docstring.format(dtype="bool"),
        },
    )
)

_dtypes = {"bool": BoolDtype()}