From e6a927cdcc7bbb52d935eb77b751d2f5fbd2a85d Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 23 Apr 2017 09:22:51 -0400 Subject: [PATCH 1/2] API: expose dtypes in pandas.api.types xref #16015 xref https://github.com/apache/arrow/pull/585 --- pandas/api/types/__init__.py | 1 + pandas/tests/api/test_types.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/api/types/__init__.py b/pandas/api/types/__init__.py index dcf010dcf4bc2..c0100b938d99d 100644 --- a/pandas/api/types/__init__.py +++ b/pandas/api/types/__init__.py @@ -1,6 +1,7 @@ """ public toolkit API """ from pandas.core.dtypes.api import * # noqa +from pandas.core.dtypes.dtypes import CategoricalDtype, DatetimeTZDtype, PeriodDtype # noqa from pandas.core.dtypes.concat import union_categoricals # noqa from pandas._libs.lib import infer_dtype # noqa del np # noqa diff --git a/pandas/tests/api/test_types.py b/pandas/tests/api/test_types.py index 3b9148a1c91c6..755b4418bd5ab 100644 --- a/pandas/tests/api/test_types.py +++ b/pandas/tests/api/test_types.py @@ -33,10 +33,11 @@ class TestTypes(Base, tm.TestCase): 'is_list_like', 'is_hashable', 'is_named_tuple', 'is_sequence', 'pandas_dtype', 'union_categoricals', 'infer_dtype'] + dtypes = ['CategoricalDtype', 'DatetimeTZDtype', 'PeriodDtype'] def test_types(self): - self.check(types, self.allowed) + self.check(types, self.allowed + self.dtypes) def check_deprecation(self, fold, fnew): with tm.assert_produces_warning(DeprecationWarning): From 41eec5cfba4283f93814be58ba0a51b1242872dd Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Mon, 24 Apr 2017 06:03:09 -0400 Subject: [PATCH 2/2] add in IntervalDtyp --- pandas/api/types/__init__.py | 5 ++++- pandas/tests/api/test_types.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pandas/api/types/__init__.py b/pandas/api/types/__init__.py index c0100b938d99d..8bda0c75f8540 100644 --- a/pandas/api/types/__init__.py +++ b/pandas/api/types/__init__.py @@ -1,7 +1,10 @@ """ public toolkit API """ from pandas.core.dtypes.api import * # noqa -from pandas.core.dtypes.dtypes import CategoricalDtype, DatetimeTZDtype, PeriodDtype # noqa +from pandas.core.dtypes.dtypes import (CategoricalDtype, # noqa + DatetimeTZDtype, + PeriodDtype, + IntervalDtype) from pandas.core.dtypes.concat import union_categoricals # noqa from pandas._libs.lib import infer_dtype # noqa del np # noqa diff --git a/pandas/tests/api/test_types.py b/pandas/tests/api/test_types.py index 755b4418bd5ab..6b37501045d40 100644 --- a/pandas/tests/api/test_types.py +++ b/pandas/tests/api/test_types.py @@ -33,7 +33,8 @@ class TestTypes(Base, tm.TestCase): 'is_list_like', 'is_hashable', 'is_named_tuple', 'is_sequence', 'pandas_dtype', 'union_categoricals', 'infer_dtype'] - dtypes = ['CategoricalDtype', 'DatetimeTZDtype', 'PeriodDtype'] + dtypes = ['CategoricalDtype', 'DatetimeTZDtype', + 'PeriodDtype', 'IntervalDtype'] def test_types(self):