Python pandas.core.dtypes.dtypes.ExtensionDtype() Examples

The following are 14 code examples of pandas.core.dtypes.dtypes.ExtensionDtype(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.core.dtypes.dtypes , or try the search function .
Example #1
Source File: multi.py    From recruit with Apache License 2.0 6 votes vote down vote up
def values(self):
        if self._tuples is not None:
            return self._tuples

        values = []

        for i in range(self.nlevels):
            vals = self._get_level_values(i)
            if is_categorical_dtype(vals):
                vals = vals.get_values()
            if (isinstance(vals.dtype, (PandasExtensionDtype, ExtensionDtype))
                    or hasattr(vals, '_box_values')):
                vals = vals.astype(object)
            vals = np.array(vals, copy=False)
            values.append(vals)

        self._tuples = lib.fast_zip(values)
        return self._tuples 
Example #2
Source File: multi.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def values(self):
        if self._tuples is not None:
            return self._tuples

        values = []

        for i in range(self.nlevels):
            vals = self._get_level_values(i)
            if is_categorical_dtype(vals):
                vals = vals.get_values()
            if (isinstance(vals.dtype, (PandasExtensionDtype, ExtensionDtype))
                    or hasattr(vals, '_box_values')):
                vals = vals.astype(object)
            vals = np.array(vals, copy=False)
            values.append(vals)

        self._tuples = lib.fast_zip(values)
        return self._tuples 
Example #3
Source File: interface.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_is_extension_array_dtype(self, data):
        assert is_extension_array_dtype(data)
        assert is_extension_array_dtype(data.dtype)
        assert is_extension_array_dtype(pd.Series(data))
        assert isinstance(data.dtype, ExtensionDtype) 
Example #4
Source File: test_common.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_is_extension_array_dtype(dtype):
    assert isinstance(dtype, dtypes.ExtensionDtype)
    assert is_extension_array_dtype(dtype) 
Example #5
Source File: interface.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_is_extension_array_dtype(self, data):
        assert is_extension_array_dtype(data)
        assert is_extension_array_dtype(data.dtype)
        assert is_extension_array_dtype(pd.Series(data))
        assert isinstance(data.dtype, ExtensionDtype) 
Example #6
Source File: test_common.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_is_not_extension_array_dtype(dtype):
    assert not isinstance(dtype, dtypes.ExtensionDtype)
    assert not is_extension_array_dtype(dtype) 
Example #7
Source File: test_common.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_is_extension_array_dtype(dtype):
    assert isinstance(dtype, dtypes.ExtensionDtype)
    assert is_extension_array_dtype(dtype) 
Example #8
Source File: interface.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_is_extension_array_dtype(self, data):
        assert is_extension_array_dtype(data)
        assert is_extension_array_dtype(data.dtype)
        assert is_extension_array_dtype(pd.Series(data))
        assert isinstance(data.dtype, ExtensionDtype) 
Example #9
Source File: test_common.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_is_extension_array_dtype(dtype):
    assert isinstance(dtype, dtypes.ExtensionDtype)
    assert is_extension_array_dtype(dtype) 
Example #10
Source File: interface.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_is_extension_array_dtype(self, data):
        assert is_extension_array_dtype(data)
        assert is_extension_array_dtype(data.dtype)
        assert is_extension_array_dtype(pd.Series(data))
        assert isinstance(data.dtype, ExtensionDtype) 
Example #11
Source File: test_common.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_is_extension_array_dtype(dtype):
    assert isinstance(dtype, dtypes.ExtensionDtype)
    assert is_extension_array_dtype(dtype) 
Example #12
Source File: interface.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_is_extension_array_dtype(self, data):
        assert is_extension_array_dtype(data)
        assert is_extension_array_dtype(data.dtype)
        assert is_extension_array_dtype(pd.Series(data))
        assert isinstance(data.dtype, ExtensionDtype) 
Example #13
Source File: test_common.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_is_not_extension_array_dtype(dtype):
    assert not isinstance(dtype, dtypes.ExtensionDtype)
    assert not is_extension_array_dtype(dtype) 
Example #14
Source File: test_common.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_is_extension_array_dtype(dtype):
    assert isinstance(dtype, dtypes.ExtensionDtype)
    assert is_extension_array_dtype(dtype)