Beispiel #1
0
    def test_basic(self):
        assert is_period_dtype(self.dtype)

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        assert is_period_dtype(pidx.dtype)
        assert is_period_dtype(pidx)
        assert is_period(pidx)

        s = Series(pidx, name='A')

        assert is_period_dtype(s.dtype)
        assert is_period_dtype(s)
        assert is_period(s)

        assert not is_period_dtype(np.dtype('float64'))
        assert not is_period_dtype(1.0)
        assert not is_period(np.dtype('float64'))
        assert not is_period(1.0)
Beispiel #2
0
    def test_basic(self):
        assert is_period_dtype(self.dtype)

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        assert is_period_dtype(pidx.dtype)
        assert is_period_dtype(pidx)
        assert is_period(pidx)

        s = Series(pidx, name='A')

        assert is_period_dtype(s.dtype)
        assert is_period_dtype(s)
        assert is_period(s)

        assert not is_period_dtype(np.dtype('float64'))
        assert not is_period_dtype(1.0)
        assert not is_period(np.dtype('float64'))
        assert not is_period(1.0)
Beispiel #3
0
    def test_basic(self):
        assert is_period_dtype(self.dtype)

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        assert is_period_dtype(pidx.dtype)
        assert is_period_dtype(pidx)
        assert is_period(pidx)

        s = Series(pidx, name='A')
        # dtypes
        # series results in object dtype currently,
        # is_period checks period_arraylike
        assert not is_period_dtype(s.dtype)
        assert not is_period_dtype(s)
        assert is_period(s)

        assert not is_period_dtype(np.dtype('float64'))
        assert not is_period_dtype(1.0)
        assert not is_period(np.dtype('float64'))
        assert not is_period(1.0)
Beispiel #4
0
    def test_basic(self):
        assert is_period_dtype(self.dtype)

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        assert is_period_dtype(pidx.dtype)
        assert is_period_dtype(pidx)
        assert is_period(pidx)

        s = Series(pidx, name='A')
        # dtypes
        # series results in object dtype currently,
        # is_period checks period_arraylike
        assert not is_period_dtype(s.dtype)
        assert not is_period_dtype(s)
        assert is_period(s)

        assert not is_period_dtype(np.dtype('float64'))
        assert not is_period_dtype(1.0)
        assert not is_period(np.dtype('float64'))
        assert not is_period(1.0)
Beispiel #5
0
    def test_basic(self):
        assert is_period_dtype(self.dtype)

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        assert is_period_dtype(pidx.dtype)
        assert is_period_dtype(pidx)
        with tm.assert_produces_warning(FutureWarning):
            assert is_period(pidx)

        s = Series(pidx, name='A')

        assert is_period_dtype(s.dtype)
        assert is_period_dtype(s)
        with tm.assert_produces_warning(FutureWarning):
            assert is_period(s)

        assert not is_period_dtype(np.dtype('float64'))
        assert not is_period_dtype(1.0)
        with tm.assert_produces_warning(FutureWarning):
            assert not is_period(np.dtype('float64'))
        with tm.assert_produces_warning(FutureWarning):
            assert not is_period(1.0)
Beispiel #6
0
    def test_basic(self):
        assert is_period_dtype(self.dtype)

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        assert is_period_dtype(pidx.dtype)
        assert is_period_dtype(pidx)
        with tm.assert_produces_warning(FutureWarning):
            assert is_period(pidx)

        s = Series(pidx, name='A')

        assert is_period_dtype(s.dtype)
        assert is_period_dtype(s)
        with tm.assert_produces_warning(FutureWarning):
            assert is_period(s)

        assert not is_period_dtype(np.dtype('float64'))
        assert not is_period_dtype(1.0)
        with tm.assert_produces_warning(FutureWarning):
            assert not is_period(np.dtype('float64'))
        with tm.assert_produces_warning(FutureWarning):
            assert not is_period(1.0)
Beispiel #7
0
def test_is_period():
    assert not com.is_period([1, 2, 3])
    assert not com.is_period(pd.Index([1, 2, 3]))
    assert com.is_period(pd.PeriodIndex(["2017-01-01"], freq="D"))
Beispiel #8
0
def test_is_period_deprecated():
    with tm.assert_produces_warning(FutureWarning):
        assert not com.is_period([1, 2, 3])
        assert not com.is_period(pd.Index([1, 2, 3]))
        assert com.is_period(pd.PeriodIndex(["2017-01-01"], freq="D"))
Beispiel #9
0
def test_is_period():
    assert not com.is_period([1, 2, 3])
    assert not com.is_period(pd.Index([1, 2, 3]))
    assert com.is_period(pd.PeriodIndex(["2017-01-01"], freq="D"))
Beispiel #10
0
def test_is_period_deprecated():
    with tm.assert_produces_warning(FutureWarning):
        assert not com.is_period([1, 2, 3])
        assert not com.is_period(pd.Index([1, 2, 3]))
        assert com.is_period(pd.PeriodIndex(["2017-01-01"], freq="D"))