Ejemplo n.º 1
0
def test_is_int64_dtype():
    assert not com.is_int64_dtype(str)
    assert not com.is_int64_dtype(float)
    assert not com.is_int64_dtype(np.int32)
    assert not com.is_int64_dtype(np.uint64)
    assert not com.is_int64_dtype(pd.Index([1, 2.]))
    assert not com.is_int64_dtype(np.array(['a', 'b']))
    assert not com.is_int64_dtype(np.array([1, 2], dtype=np.uint32))

    assert com.is_int64_dtype(np.int64)
    assert com.is_int64_dtype(np.array([1, 2], dtype=np.int64))
Ejemplo n.º 2
0
def test_is_int64_dtype():
    assert not com.is_int64_dtype(str)
    assert not com.is_int64_dtype(float)
    assert not com.is_int64_dtype(np.int32)
    assert not com.is_int64_dtype(np.uint64)
    assert not com.is_int64_dtype(pd.Index([1, 2.]))
    assert not com.is_int64_dtype(np.array(['a', 'b']))
    assert not com.is_int64_dtype(np.array([1, 2], dtype=np.uint32))

    assert com.is_int64_dtype(np.int64)
    assert com.is_int64_dtype(np.array([1, 2], dtype=np.int64))
Ejemplo n.º 3
0
    def __array__(self, dtype=None):
        # TODO(https://github.com/pandas-dev/pandas/pull/23593)
        # Maybe push to parent once datetimetz __array__ is figured out.
        if is_object_dtype(dtype):
            return np.array(list(self), dtype=object)
        elif is_int64_dtype(dtype):
            return self.asi8

        return self._data
Ejemplo n.º 4
0
    def __array__(self, dtype=None):
        # TODO(https://github.com/pandas-dev/pandas/pull/23593)
        # Maybe push to parent once datetimetz __array__ is figured out.
        if is_object_dtype(dtype):
            return np.array(list(self), dtype=object)
        elif is_int64_dtype(dtype):
            return self.asi8

        return self._data
Ejemplo n.º 5
0
 def _validate_dtype(dtype):
     """ require dtype to be None or int64 """
     if not (dtype is None or is_int64_dtype(dtype)):
         raise TypeError('Invalid to pass a non-int64 dtype to RangeIndex')
Ejemplo n.º 6
0
def test_is_not_int64_dtype(dtype):
    assert not com.is_int64_dtype(dtype)
Ejemplo n.º 7
0
def test_is_not_int64_dtype(dtype):
    assert not com.is_int64_dtype(dtype)