Skip to content

Commit 534dcc7

Browse files
committed
CLN: create pandas/types
CLN: move core/dtypes.py -> types
1 parent c6c201e commit 534dcc7

File tree

12 files changed

+11
-35
lines changed

12 files changed

+11
-35
lines changed

ci/lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RET=0
88

99
if [ "$LINT" ]; then
1010
echo "Linting"
11-
for path in 'core' 'indexes' 'io' 'stats' 'compat' 'sparse' 'tools' 'tseries' 'tests' 'computation' 'util'
11+
for path in 'core' 'indexes' 'types' 'io' 'stats' 'compat' 'sparse' 'tools' 'tseries' 'tests' 'computation' 'util'
1212
do
1313
echo "linting -> pandas/$path"
1414
flake8 pandas/$path --filename '*.py'

pandas/core/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
_possibly_infer_to_datetimelike, get_dtype_kinds, is_list_like,
2222
is_sequence, is_null_slice, is_bool, _ensure_object, _ensure_int64,
2323
_coerce_indexer_dtype, take_1d)
24-
from pandas.core.dtypes import CategoricalDtype
24+
from pandas.types.api import CategoricalDtype
2525
from pandas.util.terminal import get_terminal_size
2626
from pandas.core.config import get_option
2727

pandas/core/common.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
from pandas import compat
1919
from pandas.compat import (BytesIO, range, long, u, zip, map, string_types,
2020
iteritems)
21-
from pandas.core.dtypes import (CategoricalDtype, CategoricalDtypeType,
22-
DatetimeTZDtype, DatetimeTZDtypeType)
21+
from pandas.types.api import *
2322
from pandas.core.config import get_option
2423

2524

@@ -2979,29 +2978,3 @@ def _random_state(state=None):
29792978
else:
29802979
raise ValueError("random_state must be an integer, a numpy "
29812980
"RandomState, or None")
2982-
2983-
2984-
def pandas_dtype(dtype):
2985-
"""
2986-
Converts input into a pandas only dtype object or a numpy dtype object.
2987-
2988-
Parameters
2989-
----------
2990-
dtype : object to be converted
2991-
2992-
Returns
2993-
-------
2994-
np.dtype or a pandas dtype
2995-
"""
2996-
if isinstance(dtype, compat.string_types):
2997-
try:
2998-
return DatetimeTZDtype.construct_from_string(dtype)
2999-
except TypeError:
3000-
pass
3001-
3002-
try:
3003-
return CategoricalDtype.construct_from_string(dtype)
3004-
except TypeError:
3005-
pass
3006-
3007-
return np.dtype(dtype)

pandas/core/internals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
_maybe_convert_string_to_object,
2121
is_categorical, is_datetimelike_v_numeric,
2222
is_numeric_v_string_like, is_internal_type)
23-
from pandas.core.dtypes import DatetimeTZDtype
23+
from pandas.types.api import DatetimeTZDtype
2424

2525
from pandas.core.index import Index, MultiIndex, _ensure_index
2626
from pandas.core.indexing import maybe_convert_indices, length_of_indexer

pandas/io/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pandas.core.api import DataFrame, Series
2020
from pandas.core.common import isnull
2121
from pandas.core.base import PandasObject
22-
from pandas.core.dtypes import DatetimeTZDtype
22+
from pandas.types.api import DatetimeTZDtype
2323
from pandas.tseries.tools import to_datetime
2424

2525
from contextlib import contextmanager

pandas/tests/frame/test_constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import pandas.core.common as com
2626
import pandas.lib as lib
2727

28-
from pandas.core.dtypes import DatetimeTZDtype
28+
from pandas.types.api import DatetimeTZDtype
2929

3030
from pandas.util.testing import (assert_numpy_array_equal,
3131
assert_series_equal,

pandas/tseries/tests/test_timezones.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pytz import NonExistentTimeError
1818

1919
import pandas.util.testing as tm
20-
from pandas.core.dtypes import DatetimeTZDtype
20+
from pandas.types.api import DatetimeTZDtype
2121
from pandas.util.testing import assert_frame_equal
2222
from pandas.compat import lrange, zip
2323

pandas/types/__init__.py

Whitespace-only changes.

pandas/types/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from pandas.types.dtypes import (CategoricalDtype, CategoricalDtypeType,
2+
DatetimeTZDtype, DatetimeTZDtypeType) # noqa
File renamed without changes.

0 commit comments

Comments
 (0)