コード例 #1
0
ファイル: test_common.py プロジェクト: Michael-E-Rose/pandas
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))
コード例 #2
0
ファイル: test_common.py プロジェクト: stucash/pandas
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))
コード例 #3
0
ファイル: timedeltas.py プロジェクト: robbuckley/pandas
    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
コード例 #4
0
ファイル: timedeltas.py プロジェクト: brianholland/pandas
    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
コード例 #5
0
ファイル: range.py プロジェクト: yuyang0809/pandas
 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')
コード例 #6
0
def test_is_not_int64_dtype(dtype):
    assert not com.is_int64_dtype(dtype)
コード例 #7
0
ファイル: test_common.py プロジェクト: clham/pandas
def test_is_not_int64_dtype(dtype):
    assert not com.is_int64_dtype(dtype)