diff --git a/pandas/core/arrays/sparse.py b/pandas/core/arrays/sparse.py index 08c961935a9902..a63b3fb53625f1 100644 --- a/pandas/core/arrays/sparse.py +++ b/pandas/core/arrays/sparse.py @@ -10,35 +10,35 @@ import numpy as np -import pandas._libs.sparse as splib -import pandas.core.algorithms as algos -import pandas.core.common as com -import pandas.io.formats.printing as printing -from pandas import compat from pandas._libs import index as libindex, lib +import pandas._libs.sparse as splib from pandas._libs.sparse import BlockIndex, IntIndex from pandas._libs.tslibs import NaT +import pandas.compat as compat from pandas.compat.numpy import function as nv -from pandas.core.accessor import PandasDelegate, delegate_names -from pandas.core.arrays import ExtensionArray, ExtensionOpsMixin -from pandas.core.base import PandasObject +from pandas.errors import PerformanceWarning + from pandas.core.dtypes.base import ExtensionDtype from pandas.core.dtypes.cast import ( astype_nansafe, construct_1d_arraylike_from_scalar, find_common_type, - infer_dtype_from_scalar, maybe_convert_platform -) + infer_dtype_from_scalar, maybe_convert_platform) from pandas.core.dtypes.common import ( is_array_like, is_bool_dtype, is_datetime64_any_dtype, is_dtype_equal, is_integer, is_list_like, is_object_dtype, is_scalar, is_string_dtype, - pandas_dtype -) + pandas_dtype) from pandas.core.dtypes.dtypes import register_extension_dtype from pandas.core.dtypes.generic import ( - ABCIndexClass, ABCSeries, ABCSparseSeries -) + ABCIndexClass, ABCSeries, ABCSparseSeries) from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna + +from pandas.core.accessor import PandasDelegate, delegate_names +import pandas.core.algorithms as algos +from pandas.core.arrays import ExtensionArray, ExtensionOpsMixin +from pandas.core.base import PandasObject +import pandas.core.common as com from pandas.core.missing import interpolate_2d -from pandas.errors import PerformanceWarning + +import pandas.io.formats.printing as printing # ---------------------------------------------------------------------------- diff --git a/pandas/core/groupby/base.py b/pandas/core/groupby/base.py index 9ef30b8fd021f7..1bf97690a84ed7 100644 --- a/pandas/core/groupby/base.py +++ b/pandas/core/groupby/base.py @@ -6,9 +6,10 @@ import types -from pandas.core.dtypes.common import is_list_like, is_scalar from pandas.util._decorators import make_signature +from pandas.core.dtypes.common import is_list_like, is_scalar + class GroupByMixin(object): """ provide the groupby facilities to the mixed object """ diff --git a/pandas/core/groupby/categorical.py b/pandas/core/groupby/categorical.py index 3e653704bbace5..85f51323a97b53 100644 --- a/pandas/core/groupby/categorical.py +++ b/pandas/core/groupby/categorical.py @@ -2,8 +2,7 @@ from pandas.core.algorithms import unique1d from pandas.core.arrays.categorical import ( - Categorical, CategoricalDtype, _recode_for_categories -) + Categorical, CategoricalDtype, _recode_for_categories) def recode_for_groupby(c, sort, observed): diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index a832eecf87721c..3ed80d266ce4df 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -8,39 +8,40 @@ import collections import copy -import warnings from functools import partial from textwrap import dedent +import warnings import numpy as np -import pandas.core.algorithms as algorithms -import pandas.core.common as com -import pandas.core.indexes.base as ibase -from pandas import compat from pandas._libs import Timestamp, lib +import pandas.compat as compat from pandas.compat import lzip, map from pandas.compat.numpy import _np_version_under1p13 -from pandas.core.arrays import Categorical -from pandas.core.base import DataError, SpecificationError +from pandas.util._decorators import Appender, Substitution + from pandas.core.dtypes.cast import maybe_downcast_to_dtype from pandas.core.dtypes.common import ( ensure_int64, ensure_platform_int, is_bool, is_datetimelike, - is_integer_dtype, is_interval_dtype, is_numeric_dtype, is_scalar -) + is_integer_dtype, is_interval_dtype, is_numeric_dtype, is_scalar) from pandas.core.dtypes.missing import isna, notna + +import pandas.core.algorithms as algorithms +from pandas.core.arrays import Categorical +from pandas.core.base import DataError, SpecificationError +import pandas.core.common as com from pandas.core.frame import DataFrame from pandas.core.generic import NDFrame, _shared_docs from pandas.core.groupby import base from pandas.core.groupby.groupby import ( - GroupBy, _apply_docs, _transform_template -) + GroupBy, _apply_docs, _transform_template) from pandas.core.index import CategoricalIndex, Index, MultiIndex +import pandas.core.indexes.base as ibase from pandas.core.internals import BlockManager, make_block from pandas.core.panel import Panel from pandas.core.series import Series + from pandas.plotting._core import boxplot_frame_groupby -from pandas.util._decorators import Appender, Substitution class NDFrameGroupBy(GroupBy): diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 5acccbf688e30c..e31929434b5d60 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -8,35 +8,36 @@ class providing the base-class of operations. """ import collections +from contextlib import contextmanager import datetime +from functools import partial, wraps import types import warnings -from contextlib import contextmanager -from functools import partial, wraps import numpy as np -import pandas.core.algorithms as algorithms -import pandas.core.common as com -from pandas import compat from pandas._libs import Timestamp, groupby as libgroupby +import pandas.compat as compat from pandas.compat import callable, range, set_function_name, zip from pandas.compat.numpy import function as nv -from pandas.core.base import ( - DataError, GroupByError, PandasObject, SelectionMixin, SpecificationError -) -from pandas.core.config import option_context +from pandas.util._decorators import Appender, Substitution, cache_readonly +from pandas.util._validators import validate_kwargs + from pandas.core.dtypes.cast import maybe_downcast_to_dtype from pandas.core.dtypes.common import ensure_float, is_numeric_dtype, is_scalar from pandas.core.dtypes.missing import isna, notna + +import pandas.core.algorithms as algorithms +from pandas.core.base import ( + DataError, GroupByError, PandasObject, SelectionMixin, SpecificationError) +import pandas.core.common as com +from pandas.core.config import option_context from pandas.core.frame import DataFrame from pandas.core.generic import NDFrame from pandas.core.groupby import base from pandas.core.index import Index, MultiIndex from pandas.core.series import Series from pandas.core.sorting import get_group_index_sorter -from pandas.util._decorators import Appender, Substitution, cache_readonly -from pandas.util._validators import validate_kwargs _doc_template = """ diff --git a/pandas/core/groupby/grouper.py b/pandas/core/groupby/grouper.py index cbe87040b81179..b49bc5ee5950f9 100644 --- a/pandas/core/groupby/grouper.py +++ b/pandas/core/groupby/grouper.py @@ -7,22 +7,24 @@ import numpy as np -import pandas.core.algorithms as algorithms -import pandas.core.common as com -from pandas import compat +import pandas.compat as compat from pandas.compat import callable, zip -from pandas.core.arrays import Categorical, ExtensionArray +from pandas.util._decorators import cache_readonly + from pandas.core.dtypes.common import ( ensure_categorical, is_categorical_dtype, is_datetime64_dtype, is_hashable, - is_list_like, is_scalar, is_timedelta64_dtype -) + is_list_like, is_scalar, is_timedelta64_dtype) from pandas.core.dtypes.generic import ABCSeries + +import pandas.core.algorithms as algorithms +from pandas.core.arrays import Categorical, ExtensionArray +import pandas.core.common as com from pandas.core.frame import DataFrame from pandas.core.groupby.ops import BaseGrouper from pandas.core.index import CategoricalIndex, Index, MultiIndex from pandas.core.series import Series + from pandas.io.formats.printing import pprint_thing -from pandas.util._decorators import cache_readonly class Grouper(object): diff --git a/pandas/core/groupby/ops.py b/pandas/core/groupby/ops.py index af22744c4feec2..390334a89cbfea 100644 --- a/pandas/core/groupby/ops.py +++ b/pandas/core/groupby/ops.py @@ -11,18 +11,20 @@ import numpy as np -import pandas.core.algorithms as algorithms -import pandas.core.common as com from pandas._libs import NaT, groupby as libgroupby, iNaT, lib, reduction from pandas.compat import lzip, range, zip -from pandas.core.base import SelectionMixin +from pandas.util._decorators import cache_readonly + from pandas.core.dtypes.common import ( ensure_float64, ensure_int64, ensure_int64_or_float64, ensure_object, ensure_platform_int, is_bool_dtype, is_categorical_dtype, is_complex_dtype, is_datetime64_any_dtype, is_integer_dtype, is_numeric_dtype, - is_timedelta64_dtype, needs_i8_conversion -) + is_timedelta64_dtype, needs_i8_conversion) from pandas.core.dtypes.missing import _maybe_fill, isna + +import pandas.core.algorithms as algorithms +from pandas.core.base import SelectionMixin +import pandas.core.common as com from pandas.core.frame import DataFrame from pandas.core.generic import NDFrame from pandas.core.groupby import base @@ -30,9 +32,7 @@ from pandas.core.series import Series from pandas.core.sorting import ( compress_group_index, decons_obs_group_ids, get_flattened_iterator, - get_group_index, get_group_index_sorter, get_indexer_dict -) -from pandas.util._decorators import cache_readonly + get_group_index, get_group_index_sorter, get_indexer_dict) def generate_bins_generic(values, binner, closed): diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 2b2f9ca51ce12c..cce5fda7dba281 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -1,25 +1,26 @@ -import operator -import warnings from datetime import timedelta +import operator from sys import getsizeof +import warnings import numpy as np -import pandas.core.common as com -import pandas.core.indexes.base as ibase -from pandas import compat from pandas._libs import index as libindex +import pandas.compat as compat from pandas.compat import get_range_parameters, lrange, range from pandas.compat.numpy import function as nv -from pandas.core import ops +from pandas.util._decorators import Appender, cache_readonly + from pandas.core.dtypes import concat as _concat from pandas.core.dtypes.common import ( - is_int64_dtype, is_integer, is_scalar, is_timedelta64_dtype -) + is_int64_dtype, is_integer, is_scalar, is_timedelta64_dtype) from pandas.core.dtypes.generic import ABCSeries, ABCTimedeltaIndex + +from pandas.core import ops +import pandas.core.common as com +import pandas.core.indexes.base as ibase from pandas.core.indexes.base import Index, _index_shared_docs from pandas.core.indexes.numeric import Int64Index -from pandas.util._decorators import Appender, cache_readonly class RangeIndex(Int64Index): diff --git a/pandas/core/series.py b/pandas/core/series.py index 64d2e803dc8e19..6cc5acc4a61d0b 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3,54 +3,47 @@ """ from __future__ import division -import warnings from textwrap import dedent +import warnings import numpy as np import numpy.ma as ma -import pandas.core.algorithms as algorithms -import pandas.core.common as com -import pandas.core.indexes.base as ibase -import pandas.core.nanops as nanops -import pandas.core.ops as ops -import pandas.io.formats.format as fmt -import pandas.plotting._core as gfx -from pandas import compat from pandas._libs import iNaT, index as libindex, lib, tslibs +import pandas.compat as compat from pandas.compat import ( - PY36, OrderedDict, StringIO, get_range_parameters, range, u, zip -) + PY36, OrderedDict, StringIO, get_range_parameters, range, u, zip) from pandas.compat.numpy import function as nv -from pandas.core import base, generic -from pandas.core.accessor import CachedAccessor -from pandas.core.arrays import ExtensionArray, SparseArray, period_array -from pandas.core.arrays.categorical import Categorical, CategoricalAccessor -from pandas.core.arrays.sparse import SparseAccessor -from pandas.core.config import get_option +from pandas.util._decorators import Appender, Substitution, deprecate +from pandas.util._validators import validate_bool_kwarg + from pandas.core.dtypes.cast import ( construct_1d_arraylike_from_scalar, construct_1d_ndarray_preserving_na, construct_1d_object_array_from_listlike, infer_dtype_from_scalar, maybe_cast_to_datetime, maybe_cast_to_integer_array, maybe_castable, - maybe_convert_platform, maybe_upcast -) + maybe_convert_platform, maybe_upcast) from pandas.core.dtypes.common import ( _is_unorderable_exception, ensure_platform_int, is_bool, is_categorical_dtype, is_datetime64tz_dtype, is_datetimelike, is_dict_like, is_extension_array_dtype, is_extension_type, is_float_dtype, is_hashable, is_integer, is_integer_dtype, is_iterator, is_list_like, is_object_dtype, - is_scalar, is_string_like, is_timedelta64_dtype, pandas_dtype -) + is_scalar, is_string_like, is_timedelta64_dtype, pandas_dtype) from pandas.core.dtypes.generic import ( - ABCDataFrame, ABCIndexClass, ABCSeries, ABCSparseArray, ABCSparseSeries -) + ABCDataFrame, ABCIndexClass, ABCSeries, ABCSparseArray, ABCSparseSeries) from pandas.core.dtypes.missing import ( - isna, na_value_for_dtype, notna, remove_na_arraylike -) + isna, na_value_for_dtype, notna, remove_na_arraylike) + +from pandas.core import algorithms, base, generic, nanops, ops +from pandas.core.accessor import CachedAccessor +from pandas.core.arrays import ExtensionArray, SparseArray, period_array +from pandas.core.arrays.categorical import Categorical, CategoricalAccessor +from pandas.core.arrays.sparse import SparseAccessor +import pandas.core.common as com +from pandas.core.config import get_option from pandas.core.index import ( - Float64Index, Index, InvalidIndexError, MultiIndex, ensure_index -) + Float64Index, Index, InvalidIndexError, MultiIndex, ensure_index) from pandas.core.indexes.accessors import CombinedDatetimelikeProperties +import pandas.core.indexes.base as ibase from pandas.core.indexes.datetimes import DatetimeIndex from pandas.core.indexes.period import PeriodIndex from pandas.core.indexes.timedeltas import TimedeltaIndex @@ -58,9 +51,10 @@ from pandas.core.internals import SingleBlockManager from pandas.core.strings import StringMethods from pandas.core.tools.datetimes import to_datetime + +import pandas.io.formats.format as fmt from pandas.io.formats.terminal import get_terminal_size -from pandas.util._decorators import Appender, Substitution, deprecate -from pandas.util._validators import validate_bool_kwarg +import pandas.plotting._core as gfx # pylint: disable=E1101,E1103 # pylint: disable=W0703,W0622,W0613,W0201 diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index 287a03c2e5728c..c6108f30a560a2 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -1,10 +1,13 @@ """ io on the clipboard """ import warnings -from pandas import compat, get_option, option_context +import pandas.compat as compat from pandas.compat import PY2, PY3, StringIO + from pandas.core.dtypes.generic import ABCDataFrame +from pandas import get_option, option_context + def read_clipboard(sep=r'\s+', **kwargs): # pragma: no cover r""" diff --git a/pandas/io/common.py b/pandas/io/common.py index 40247c4aebd1e9..155cf566b4c405 100644 --- a/pandas/io/common.py +++ b/pandas/io/common.py @@ -1,20 +1,21 @@ """Common IO api utilities""" import codecs +from contextlib import closing, contextmanager import csv import mmap import os import zipfile -from contextlib import closing, contextmanager -import pandas.core.common as com -from pandas import compat +import pandas.compat as compat from pandas.compat import BytesIO, StringIO, string_types, text_type -from pandas.core.dtypes.common import is_file_like, is_number -# compat from pandas.errors import ( # noqa - DtypeWarning, EmptyDataError, ParserError, ParserWarning -) + DtypeWarning, EmptyDataError, ParserError, ParserWarning) + +from pandas.core.dtypes.common import is_file_like, is_number + +import pandas.core.common as com + from pandas.io.formats.printing import pprint_thing # gh-12665: Alias for now and remove later. diff --git a/pandas/io/excel.py b/pandas/io/excel.py index c6a04b9bdee200..7a7b801f4ba4ac 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -2,15 +2,15 @@ Module parse to/from Excel """ -import abc -import os -import warnings # --------------------------------------------------------------------- # ExcelFile class +import abc from datetime import MINYEAR, date, datetime, time, timedelta from distutils.version import LooseVersion from io import UnsupportedOperation +import os from textwrap import fill +import warnings import numpy as np @@ -18,21 +18,21 @@ import pandas.compat as compat from pandas.compat import ( OrderedDict, add_metaclass, lrange, map, range, reduce, string_types, u, - zip -) -from pandas.core import config + zip) +from pandas.errors import EmptyDataError +from pandas.util._decorators import Appender, deprecate_kwarg + from pandas.core.dtypes.common import ( - is_bool, is_float, is_integer, is_list_like -) + is_bool, is_float, is_integer, is_list_like) + +from pandas.core import config from pandas.core.frame import DataFrame -from pandas.errors import EmptyDataError + from pandas.io.common import ( _NA_VALUES, _is_url, _stringify_path, _urlopen, _validate_header_arg, - get_filepath_or_buffer -) + get_filepath_or_buffer) from pandas.io.formats.printing import pprint_thing from pandas.io.parsers import TextParser -from pandas.util._decorators import Appender, deprecate_kwarg __all__ = ["read_excel", "ExcelWriter", "ExcelFile"] diff --git a/pandas/io/feather_format.py b/pandas/io/feather_format.py index 436c16839ffc24..8d2715fe5beedd 100644 --- a/pandas/io/feather_format.py +++ b/pandas/io/feather_format.py @@ -2,8 +2,10 @@ from distutils.version import LooseVersion -from pandas import DataFrame, Int64Index, RangeIndex from pandas.compat import range + +from pandas import DataFrame, Int64Index, RangeIndex + from pandas.io.common import _stringify_path diff --git a/pandas/io/html.py b/pandas/io/html.py index a1d3f4589ba352..4f887b69646ee9 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -3,19 +3,22 @@ """ +from distutils.version import LooseVersion import numbers import os import re -from distutils.version import LooseVersion -import pandas.core.common as com -from pandas import Series, compat +import pandas.compat as compat from pandas.compat import ( binary_type, iteritems, lmap, lrange, raise_with_traceback, string_types, - u -) -from pandas.core.dtypes.common import is_list_like + u) from pandas.errors import EmptyDataError + +from pandas.core.dtypes.common import is_list_like + +from pandas import Series +import pandas.core.common as com + from pandas.io.common import _is_url, _validate_header_arg, urlopen from pandas.io.formats.printing import pprint_thing from pandas.io.parsers import TextParser diff --git a/pandas/io/packers.py b/pandas/io/packers.py index 764e27a60abb50..ea673101e90b37 100644 --- a/pandas/io/packers.py +++ b/pandas/io/packers.py @@ -38,35 +38,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ -import os -import warnings from datetime import date, datetime, timedelta +import os from textwrap import dedent +import warnings -import numpy as np from dateutil.parser import parse +import numpy as np + +import pandas.compat as compat +from pandas.compat import u, u_safe +from pandas.errors import PerformanceWarning +from pandas.util._move import ( + BadMove as _BadMove, move_into_mutable_buffer as _move_into_mutable_buffer) + +from pandas.core.dtypes.common import ( + is_categorical_dtype, is_object_dtype, needs_i8_conversion, pandas_dtype) from pandas import ( # noqa:F401 Categorical, CategoricalIndex, DataFrame, DatetimeIndex, Float64Index, Index, Int64Index, Interval, IntervalIndex, MultiIndex, NaT, Panel, Period, - PeriodIndex, RangeIndex, Series, TimedeltaIndex, Timestamp, compat -) -from pandas.compat import u, u_safe + PeriodIndex, RangeIndex, Series, TimedeltaIndex, Timestamp) from pandas.core import internals from pandas.core.arrays import IntervalArray, PeriodArray from pandas.core.arrays.sparse import BlockIndex, IntIndex -from pandas.core.dtypes.common import ( - is_categorical_dtype, is_object_dtype, needs_i8_conversion, pandas_dtype -) from pandas.core.generic import NDFrame from pandas.core.internals import BlockManager, _safe_reshape, make_block from pandas.core.sparse.api import SparseDataFrame, SparseSeries -from pandas.errors import PerformanceWarning + from pandas.io.common import _stringify_path, get_filepath_or_buffer from pandas.io.msgpack import ExtType, Packer as _Packer, Unpacker as _Unpacker -from pandas.util._move import ( - BadMove as _BadMove, move_into_mutable_buffer as _move_into_mutable_buffer -) # check which compression libs we have installed try: diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py index aef1d84a19bc75..2c75f46385e868 100644 --- a/pandas/io/parquet.py +++ b/pandas/io/parquet.py @@ -3,9 +3,11 @@ from distutils.version import LooseVersion from warnings import catch_warnings -import pandas.core.common as com -from pandas import DataFrame, Int64Index, RangeIndex, get_option from pandas.compat import string_types + +from pandas import DataFrame, Int64Index, RangeIndex, get_option +import pandas.core.common as com + from pandas.io.common import get_filepath_or_buffer, is_s3_url diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 8dd50fceb4efb8..cd9d3ccb79af84 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -3,49 +3,48 @@ """ from __future__ import print_function +from collections import defaultdict import csv import datetime import re import sys -import warnings -from collections import defaultdict from textwrap import fill +import warnings import numpy as np import pandas._libs.lib as lib import pandas._libs.ops as libops import pandas._libs.parsers as parsers -import pandas.core.common as com -from pandas import compat from pandas._libs.tslibs import parsing +import pandas.compat as compat from pandas.compat import ( - PY3, StringIO, lrange, lzip, map, range, string_types, u, zip -) -from pandas.core import algorithms -from pandas.core.arrays import Categorical + PY3, StringIO, lrange, lzip, map, range, string_types, u, zip) +from pandas.errors import EmptyDataError, ParserError, ParserWarning +from pandas.util._decorators import Appender + from pandas.core.dtypes.cast import astype_nansafe from pandas.core.dtypes.common import ( ensure_object, is_categorical_dtype, is_dtype_equal, is_float, is_integer, is_integer_dtype, is_list_like, is_object_dtype, is_scalar, - is_string_dtype -) + is_string_dtype) from pandas.core.dtypes.dtypes import CategoricalDtype from pandas.core.dtypes.missing import isna + +from pandas.core import algorithms +from pandas.core.arrays import Categorical +import pandas.core.common as com from pandas.core.frame import DataFrame from pandas.core.index import ( - Index, MultiIndex, RangeIndex, ensure_index_from_sequences -) + Index, MultiIndex, RangeIndex, ensure_index_from_sequences) from pandas.core.series import Series from pandas.core.tools import datetimes as tools -from pandas.errors import EmptyDataError, ParserError, ParserWarning + from pandas.io.common import ( _NA_VALUES, BaseIterator, UnicodeReader, UTF8Recoder, _get_handle, _infer_compression, _validate_header_arg, get_filepath_or_buffer, - is_file_like -) + is_file_like) from pandas.io.date_converters import generic_parser -from pandas.util._decorators import Appender # BOM character (byte order mark) # This exists at the beginning of a file to indicate endianness diff --git a/pandas/io/pickle.py b/pandas/io/pickle.py index 4e71462f4e3310..c89d1df8ee64ba 100644 --- a/pandas/io/pickle.py +++ b/pandas/io/pickle.py @@ -5,7 +5,9 @@ from numpy.lib.format import read_array, write_array from pandas.compat import PY3, BytesIO, cPickle as pkl, pickle_compat as pc + from pandas.core.dtypes.common import _NS_DTYPE, is_datetime64_dtype + from pandas.io.common import _get_handle, _stringify_path diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 0830aece8c6f4c..56b63fddd96ad5 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -5,46 +5,45 @@ """ import copy +from datetime import date, datetime +from distutils.version import LooseVersion import itertools import os import re import time import warnings -from datetime import date, datetime -from distutils.version import LooseVersion import numpy as np -import pandas.core.common as com -from pandas import ( - DataFrame, DatetimeIndex, Index, Int64Index, MultiIndex, Panel, - PeriodIndex, Series, SparseDataFrame, SparseSeries, TimedeltaIndex, compat, - concat, isna, to_datetime -) from pandas._libs import algos, lib, writers as libwriters from pandas._libs.tslibs import timezones from pandas.compat import PY3, filter, lrange, range, string_types +from pandas.errors import PerformanceWarning + +from pandas.core.dtypes.common import ( + ensure_int64, ensure_object, ensure_platform_int, is_categorical_dtype, + is_datetime64_dtype, is_datetime64tz_dtype, is_list_like, + is_timedelta64_dtype) +from pandas.core.dtypes.missing import array_equivalent + +from pandas import ( + DataFrame, DatetimeIndex, Index, Int64Index, MultiIndex, Panel, + PeriodIndex, Series, SparseDataFrame, SparseSeries, TimedeltaIndex, compat, + concat, isna, to_datetime) from pandas.core import config from pandas.core.algorithms import match, unique from pandas.core.arrays.categorical import ( - Categorical, _factorize_from_iterables -) + Categorical, _factorize_from_iterables) from pandas.core.arrays.sparse import BlockIndex, IntIndex from pandas.core.base import StringMixin +import pandas.core.common as com from pandas.core.computation.pytables import Expr, maybe_expression from pandas.core.config import get_option -from pandas.core.dtypes.common import ( - ensure_int64, ensure_object, ensure_platform_int, is_categorical_dtype, - is_datetime64_dtype, is_datetime64tz_dtype, is_list_like, - is_timedelta64_dtype -) -from pandas.core.dtypes.missing import array_equivalent from pandas.core.index import ensure_index from pandas.core.internals import ( BlockManager, _block2d_to_blocknd, _block_shape, _factor_indexer, - make_block -) -from pandas.errors import PerformanceWarning + make_block) + from pandas.io.common import _stringify_path from pandas.io.formats.printing import adjoin, pprint_thing diff --git a/pandas/io/sas/sas_xport.py b/pandas/io/sas/sas_xport.py index c326580487b094..6a38e3d2eb783d 100644 --- a/pandas/io/sas/sas_xport.py +++ b/pandas/io/sas/sas_xport.py @@ -8,16 +8,18 @@ https://support.sas.com/techsup/technote/ts140.pdf """ +from datetime import datetime import struct import warnings -from datetime import datetime import numpy as np +from pandas.util._decorators import Appender + import pandas as pd from pandas import compat + from pandas.io.common import BaseIterator, get_filepath_or_buffer -from pandas.util._decorators import Appender _correct_line1 = ("HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!" "000000000000000000000000000000 ") diff --git a/pandas/io/sas/sasreader.py b/pandas/io/sas/sasreader.py index d72996a8e6157a..2da3775d5a6a74 100644 --- a/pandas/io/sas/sasreader.py +++ b/pandas/io/sas/sasreader.py @@ -2,6 +2,7 @@ Read SAS sas7bdat or xport files. """ from pandas import compat + from pandas.io.common import _stringify_path diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 3876792d6226fe..00fbc35ed1e7db 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -6,24 +6,24 @@ from __future__ import division, print_function -import re -import warnings from contextlib import contextmanager from datetime import date, datetime, time +import re +import warnings import numpy as np import pandas._libs.lib as lib from pandas.compat import ( - map, raise_with_traceback, string_types, text_type, zip -) -from pandas.core.api import DataFrame, Series -from pandas.core.base import PandasObject + map, raise_with_traceback, string_types, text_type, zip) + from pandas.core.dtypes.common import ( - is_datetime64tz_dtype, is_dict_like, is_list_like -) + is_datetime64tz_dtype, is_dict_like, is_list_like) from pandas.core.dtypes.dtypes import DatetimeTZDtype from pandas.core.dtypes.missing import isna + +from pandas.core.api import DataFrame, Series +from pandas.core.base import PandasObject from pandas.core.tools.datetimes import to_datetime diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 00d1a925879302..df0d47b063411f 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -10,33 +10,33 @@ http://www.statsmodels.org/devel/ """ +from collections import OrderedDict import datetime import struct import sys import warnings -from collections import OrderedDict -import numpy as np from dateutil.relativedelta import relativedelta +import numpy as np -from pandas import DatetimeIndex, compat, isna, to_datetime, to_timedelta from pandas._libs.lib import infer_dtype from pandas._libs.tslibs import NaT, Timestamp from pandas._libs.writers import max_len_string_array from pandas.compat import ( - BytesIO, lmap, lrange, lzip, range, string_types, text_type, zip -) + BytesIO, lmap, lrange, lzip, range, string_types, text_type, zip) +from pandas.util._decorators import Appender, deprecate_kwarg + +from pandas.core.dtypes.common import ( + ensure_object, is_categorical_dtype, is_datetime64_dtype) + +from pandas import DatetimeIndex, compat, isna, to_datetime, to_timedelta from pandas.core.arrays import Categorical from pandas.core.base import StringMixin -from pandas.core.dtypes.common import ( - ensure_object, is_categorical_dtype, is_datetime64_dtype -) from pandas.core.frame import DataFrame from pandas.core.series import Series + from pandas.io.common import ( - BaseIterator, _stringify_path, get_filepath_or_buffer -) -from pandas.util._decorators import Appender, deprecate_kwarg + BaseIterator, _stringify_path, get_filepath_or_buffer) _version_error = ("Version of given Stata file is not 104, 105, 108, " "111 (Stata 7SE), 113 (Stata 8/9), 114 (Stata 10/11), " diff --git a/pandas/tests/arrays/categorical/test_analytics.py b/pandas/tests/arrays/categorical/test_analytics.py index 18cce6573817c0..0f292a457bbc25 100644 --- a/pandas/tests/arrays/categorical/test_analytics.py +++ b/pandas/tests/arrays/categorical/test_analytics.py @@ -5,10 +5,11 @@ import numpy as np import pytest -import pandas.util.testing as tm -from pandas import Categorical, Index, Series from pandas.compat import PYPY +from pandas import Categorical, Index, Series +import pandas.util.testing as tm + class TestCategoricalAnalytics(object): diff --git a/pandas/tests/arrays/categorical/test_api.py b/pandas/tests/arrays/categorical/test_api.py index 1deef4762be266..54de398473d522 100644 --- a/pandas/tests/arrays/categorical/test_api.py +++ b/pandas/tests/arrays/categorical/test_api.py @@ -3,10 +3,10 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import Categorical, CategoricalIndex, DataFrame, Index, Series from pandas.core.arrays.categorical import _recode_for_categories from pandas.tests.arrays.categorical.common import TestCategorical +import pandas.util.testing as tm class TestCategoricalAPI(object): diff --git a/pandas/tests/arrays/categorical/test_constructors.py b/pandas/tests/arrays/categorical/test_constructors.py index b53fd0aa80344d..8bd245d2aabae0 100644 --- a/pandas/tests/arrays/categorical/test_constructors.py +++ b/pandas/tests/arrays/categorical/test_constructors.py @@ -5,15 +5,15 @@ import numpy as np import pytest +from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype +from pandas.core.dtypes.dtypes import CategoricalDtype + import pandas as pd -import pandas.util.testing as tm from pandas import ( Categorical, CategoricalIndex, DatetimeIndex, Index, Interval, IntervalIndex, NaT, Series, Timestamp, date_range, period_range, - timedelta_range -) -from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype -from pandas.core.dtypes.dtypes import CategoricalDtype + timedelta_range) +import pandas.util.testing as tm class TestCategoricalConstructors(object): diff --git a/pandas/tests/arrays/categorical/test_dtypes.py b/pandas/tests/arrays/categorical/test_dtypes.py index 7d4824fe7d18a6..491a7867fee719 100644 --- a/pandas/tests/arrays/categorical/test_dtypes.py +++ b/pandas/tests/arrays/categorical/test_dtypes.py @@ -2,11 +2,13 @@ import numpy as np import pytest -import pandas.util.testing as tm -from pandas import Categorical, CategoricalIndex, Index, Series, Timestamp from pandas.compat import long + from pandas.core.dtypes.dtypes import CategoricalDtype +from pandas import Categorical, CategoricalIndex, Index, Series, Timestamp +import pandas.util.testing as tm + class TestCategoricalDtypes(object): diff --git a/pandas/tests/arrays/categorical/test_indexing.py b/pandas/tests/arrays/categorical/test_indexing.py index d74a7d5d2ed5d4..a54ee7381f9ebd 100644 --- a/pandas/tests/arrays/categorical/test_indexing.py +++ b/pandas/tests/arrays/categorical/test_indexing.py @@ -3,10 +3,10 @@ import numpy as np import pytest -import pandas.core.common as com -import pandas.util.testing as tm from pandas import Categorical, CategoricalIndex, Index, PeriodIndex, Series +import pandas.core.common as com from pandas.tests.arrays.categorical.common import TestCategorical +import pandas.util.testing as tm class TestCategoricalIndexingWithFactor(TestCategorical): diff --git a/pandas/tests/arrays/categorical/test_operators.py b/pandas/tests/arrays/categorical/test_operators.py index a4b39846cbfaf1..ce15ebfb281f27 100644 --- a/pandas/tests/arrays/categorical/test_operators.py +++ b/pandas/tests/arrays/categorical/test_operators.py @@ -4,9 +4,9 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import Categorical, DataFrame, Series, date_range from pandas.tests.arrays.categorical.common import TestCategorical +import pandas.util.testing as tm class TestCategoricalOpsWithFactor(TestCategorical): diff --git a/pandas/tests/arrays/categorical/test_repr.py b/pandas/tests/arrays/categorical/test_repr.py index 3c830ee6f6da53..5f71d0148ee88f 100644 --- a/pandas/tests/arrays/categorical/test_repr.py +++ b/pandas/tests/arrays/categorical/test_repr.py @@ -2,11 +2,11 @@ import numpy as np +from pandas.compat import PY3, u + from pandas import ( Categorical, CategoricalIndex, Series, date_range, period_range, - timedelta_range -) -from pandas.compat import PY3, u + timedelta_range) from pandas.core.config import option_context from pandas.tests.arrays.categorical.common import TestCategorical diff --git a/pandas/tests/arrays/categorical/test_subclass.py b/pandas/tests/arrays/categorical/test_subclass.py index 08ebb7d1b05f75..7e90f8d51a3efe 100644 --- a/pandas/tests/arrays/categorical/test_subclass.py +++ b/pandas/tests/arrays/categorical/test_subclass.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -import pandas.util.testing as tm from pandas import Categorical +import pandas.util.testing as tm class TestCategoricalSubclassing(object): diff --git a/pandas/tests/arrays/interval/test_interval.py b/pandas/tests/arrays/interval/test_interval.py index ff69b68f1117c3..9a191dda3a73a5 100644 --- a/pandas/tests/arrays/interval/test_interval.py +++ b/pandas/tests/arrays/interval/test_interval.py @@ -2,9 +2,9 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import Index, IntervalIndex, date_range, timedelta_range from pandas.core.arrays import IntervalArray +import pandas.util.testing as tm @pytest.fixture(params=[ diff --git a/pandas/tests/arrays/interval/test_ops.py b/pandas/tests/arrays/interval/test_ops.py index 7000ff0f0c3f6f..45bf465577aceb 100644 --- a/pandas/tests/arrays/interval/test_ops.py +++ b/pandas/tests/arrays/interval/test_ops.py @@ -2,9 +2,9 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import Interval, IntervalIndex, Timedelta, Timestamp from pandas.core.arrays import IntervalArray +import pandas.util.testing as tm @pytest.fixture(params=[IntervalArray, IntervalIndex]) diff --git a/pandas/tests/arrays/sparse/test_arithmetics.py b/pandas/tests/arrays/sparse/test_arithmetics.py index 2aa24fff3d1d7c..42a29654b44d51 100644 --- a/pandas/tests/arrays/sparse/test_arithmetics.py +++ b/pandas/tests/arrays/sparse/test_arithmetics.py @@ -4,8 +4,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas.core.sparse.api import SparseDtype +import pandas.util.testing as tm class TestSparseArrayArithmetics(object): diff --git a/pandas/tests/arrays/sparse/test_array.py b/pandas/tests/arrays/sparse/test_array.py index 45c23735a986bc..852c4fb9105601 100644 --- a/pandas/tests/arrays/sparse/test_array.py +++ b/pandas/tests/arrays/sparse/test_array.py @@ -3,15 +3,16 @@ import warnings import numpy as np -import pytest from numpy import nan +import pytest -import pandas as pd -import pandas.util._test_decorators as td -import pandas.util.testing as tm from pandas._libs.sparse import IntIndex from pandas.compat import range +import pandas.util._test_decorators as td + +import pandas as pd from pandas.core.sparse.api import SparseArray, SparseDtype, SparseSeries +import pandas.util.testing as tm from pandas.util.testing import assert_almost_equal diff --git a/pandas/tests/arrays/sparse/test_dtype.py b/pandas/tests/arrays/sparse/test_dtype.py index d3e2116882739f..75fc325b07a082 100644 --- a/pandas/tests/arrays/sparse/test_dtype.py +++ b/pandas/tests/arrays/sparse/test_dtype.py @@ -2,8 +2,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas.core.sparse.api import SparseDtype +import pandas.util.testing as tm @pytest.mark.parametrize("dtype, fill_value", [ diff --git a/pandas/tests/arrays/sparse/test_libsparse.py b/pandas/tests/arrays/sparse/test_libsparse.py index e6ebd92c6ffdc5..cbad7e8e9136d7 100644 --- a/pandas/tests/arrays/sparse/test_libsparse.py +++ b/pandas/tests/arrays/sparse/test_libsparse.py @@ -5,9 +5,10 @@ import pandas._libs.sparse as splib import pandas.util._test_decorators as td -import pandas.util.testing as tm + from pandas import Series from pandas.core.arrays.sparse import BlockIndex, IntIndex, _make_index +import pandas.util.testing as tm TEST_LENGTH = 20 diff --git a/pandas/tests/arrays/test_period.py b/pandas/tests/arrays/test_period.py index dcbb0d4048b0f8..40bdd4f1aaa5c6 100644 --- a/pandas/tests/arrays/test_period.py +++ b/pandas/tests/arrays/test_period.py @@ -1,14 +1,16 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm from pandas._libs.tslibs import iNaT from pandas._libs.tslibs.period import IncompatibleFrequency -from pandas.core.arrays import PeriodArray, period_array + from pandas.core.dtypes.common import pandas_dtype from pandas.core.dtypes.dtypes import PeriodDtype +import pandas as pd +from pandas.core.arrays import PeriodArray, period_array +import pandas.util.testing as tm + # ---------------------------------------------------------------------------- # Constructors diff --git a/pandas/tests/extension/arrow/bool.py b/pandas/tests/extension/arrow/bool.py index e6f997b01aad20..f8e357e1622326 100644 --- a/pandas/tests/extension/arrow/bool.py +++ b/pandas/tests/extension/arrow/bool.py @@ -13,8 +13,7 @@ import pandas as pd from pandas.api.extensions import ( - ExtensionArray, ExtensionDtype, register_extension_dtype, take -) + ExtensionArray, ExtensionDtype, register_extension_dtype, take) @register_extension_dtype diff --git a/pandas/tests/extension/base/constructors.py b/pandas/tests/extension/base/constructors.py index fdd2b99d9b3c76..076be53a4a72f7 100644 --- a/pandas/tests/extension/base/constructors.py +++ b/pandas/tests/extension/base/constructors.py @@ -1,8 +1,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas.core.internals import ExtensionBlock +import pandas.util.testing as tm from .base import BaseExtensionTests diff --git a/pandas/tests/extension/base/interface.py b/pandas/tests/extension/base/interface.py index 91b1b87a9d7ea6..00a480d311b58f 100644 --- a/pandas/tests/extension/base/interface.py +++ b/pandas/tests/extension/base/interface.py @@ -1,10 +1,12 @@ import numpy as np -import pandas as pd from pandas.compat import StringIO + from pandas.core.dtypes.common import is_extension_array_dtype from pandas.core.dtypes.dtypes import ExtensionDtype +import pandas as pd + from .base import BaseExtensionTests diff --git a/pandas/tests/extension/decimal/array.py b/pandas/tests/extension/decimal/array.py index e47b8049ae65c1..c14bfa359bc64b 100644 --- a/pandas/tests/extension/decimal/array.py +++ b/pandas/tests/extension/decimal/array.py @@ -5,9 +5,10 @@ import numpy as np +from pandas.core.dtypes.base import ExtensionDtype + import pandas as pd from pandas.core.arrays import ExtensionArray, ExtensionScalarOpsMixin -from pandas.core.dtypes.base import ExtensionDtype class DecimalDtype(ExtensionDtype): diff --git a/pandas/tests/extension/decimal/test_decimal.py b/pandas/tests/extension/decimal/test_decimal.py index 59e77c3f0f3f3f..1c9beefe9e5428 100644 --- a/pandas/tests/extension/decimal/test_decimal.py +++ b/pandas/tests/extension/decimal/test_decimal.py @@ -5,9 +5,9 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import compat from pandas.tests.extension import base +import pandas.util.testing as tm from .array import DecimalArray, DecimalDtype, make_data, to_decimal diff --git a/pandas/tests/extension/json/array.py b/pandas/tests/extension/json/array.py index 75b0f6b02edadb..2c6e74fda8a0e6 100644 --- a/pandas/tests/extension/json/array.py +++ b/pandas/tests/extension/json/array.py @@ -19,9 +19,10 @@ import numpy as np +from pandas.core.dtypes.base import ExtensionDtype + from pandas import compat from pandas.core.arrays import ExtensionArray -from pandas.core.dtypes.base import ExtensionDtype class JSONDtype(ExtensionDtype): diff --git a/pandas/tests/extension/json/test_json.py b/pandas/tests/extension/json/test_json.py index d6528e30855272..778432376e092c 100644 --- a/pandas/tests/extension/json/test_json.py +++ b/pandas/tests/extension/json/test_json.py @@ -3,10 +3,11 @@ import pytest -import pandas as pd -import pandas.util.testing as tm from pandas.compat import PY2, PY36 + +import pandas as pd from pandas.tests.extension import base +import pandas.util.testing as tm from .array import JSONArray, JSONDtype, make_data diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index b5ded1890ae649..65e6a15dd8df05 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -19,10 +19,10 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import Categorical from pandas.api.types import CategoricalDtype from pandas.tests.extension import base +import pandas.util.testing as tm def make_data(): diff --git a/pandas/tests/extension/test_common.py b/pandas/tests/extension/test_common.py index 8a026a0c382839..2bc4bf5df22984 100644 --- a/pandas/tests/extension/test_common.py +++ b/pandas/tests/extension/test_common.py @@ -1,12 +1,13 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas.core.arrays import ExtensionArray from pandas.core.dtypes import dtypes from pandas.core.dtypes.common import is_extension_array_dtype +import pandas as pd +from pandas.core.arrays import ExtensionArray +import pandas.util.testing as tm + class DummyDtype(dtypes.ExtensionDtype): pass diff --git a/pandas/tests/extension/test_integer.py b/pandas/tests/extension/test_integer.py index 680cf83c64b9ed..efee6473898841 100644 --- a/pandas/tests/extension/test_integer.py +++ b/pandas/tests/extension/test_integer.py @@ -16,13 +16,13 @@ import numpy as np import pytest +from pandas.core.dtypes.common import is_extension_array_dtype + import pandas as pd from pandas.core.arrays import integer_array from pandas.core.arrays.integer import ( Int8Dtype, Int16Dtype, Int32Dtype, Int64Dtype, UInt8Dtype, UInt16Dtype, - UInt32Dtype, UInt64Dtype -) -from pandas.core.dtypes.common import is_extension_array_dtype + UInt32Dtype, UInt64Dtype) from pandas.tests.extension import base diff --git a/pandas/tests/extension/test_interval.py b/pandas/tests/extension/test_interval.py index 3ffb88ef302e9f..3154f34434ce2c 100644 --- a/pandas/tests/extension/test_interval.py +++ b/pandas/tests/extension/test_interval.py @@ -16,11 +16,12 @@ import numpy as np import pytest -import pandas.util.testing as tm +from pandas.core.dtypes.dtypes import IntervalDtype + from pandas import Interval from pandas.core.arrays import IntervalArray -from pandas.core.dtypes.dtypes import IntervalDtype from pandas.tests.extension import base +import pandas.util.testing as tm def make_data(): diff --git a/pandas/tests/extension/test_period.py b/pandas/tests/extension/test_period.py index 6f59cbb66a145d..83f30aed88e651 100644 --- a/pandas/tests/extension/test_period.py +++ b/pandas/tests/extension/test_period.py @@ -1,12 +1,14 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm from pandas._libs.tslib import iNaT -from pandas.core.arrays import PeriodArray + from pandas.core.dtypes.dtypes import PeriodDtype + +import pandas as pd +from pandas.core.arrays import PeriodArray from pandas.tests.extension import base +import pandas.util.testing as tm @pytest.fixture diff --git a/pandas/tests/indexes/common.py b/pandas/tests/indexes/common.py index bec969020559c6..468b1610a91423 100644 --- a/pandas/tests/indexes/common.py +++ b/pandas/tests/indexes/common.py @@ -3,19 +3,21 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import ( - CategoricalIndex, DatetimeIndex, Float64Index, Index, Int64Index, - IntervalIndex, MultiIndex, PeriodIndex, RangeIndex, Series, TimedeltaIndex, - UInt64Index, compat, isna -) from pandas._libs.tslib import iNaT +import pandas.compat as compat from pandas.compat import PY3 + from pandas.core.dtypes.common import needs_i8_conversion from pandas.core.dtypes.dtypes import CategoricalDtype + +import pandas as pd +from pandas import ( + CategoricalIndex, DatetimeIndex, Float64Index, Index, Int64Index, + IntervalIndex, MultiIndex, PeriodIndex, RangeIndex, Series, TimedeltaIndex, + UInt64Index, isna) from pandas.core.indexes.base import InvalidIndexError from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin +import pandas.util.testing as tm class Base(object): diff --git a/pandas/tests/indexes/conftest.py b/pandas/tests/indexes/conftest.py index 4a2a4a7deb5ccf..8cfed33a96ac5b 100644 --- a/pandas/tests/indexes/conftest.py +++ b/pandas/tests/indexes/conftest.py @@ -1,10 +1,11 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm from pandas.compat import long, lzip + +import pandas as pd from pandas.core.indexes.api import Index, MultiIndex +import pandas.util.testing as tm @pytest.fixture(params=[tm.makeUnicodeIndex(100), diff --git a/pandas/tests/indexes/datetimes/test_arithmetic.py b/pandas/tests/indexes/datetimes/test_arithmetic.py index 038c4f786f69f9..de51120baeb582 100644 --- a/pandas/tests/indexes/datetimes/test_arithmetic.py +++ b/pandas/tests/indexes/datetimes/test_arithmetic.py @@ -4,10 +4,11 @@ import pytest import pytz +from pandas.errors import NullFrequencyError + import pandas as pd -import pandas.util.testing as tm from pandas import DatetimeIndex, Series, date_range -from pandas.errors import NullFrequencyError +import pandas.util.testing as tm class TestDatetimeIndexArithmetic(object): diff --git a/pandas/tests/indexes/datetimes/test_astype.py b/pandas/tests/indexes/datetimes/test_astype.py index 8895624d74e898..a9cfc551e073b1 100644 --- a/pandas/tests/indexes/datetimes/test_astype.py +++ b/pandas/tests/indexes/datetimes/test_astype.py @@ -1,17 +1,16 @@ from datetime import datetime import dateutil +from dateutil.tz import tzlocal import numpy as np import pytest import pytz -from dateutil.tz import tzlocal import pandas as pd -import pandas.util.testing as tm from pandas import ( DatetimeIndex, Index, Int64Index, NaT, Period, Series, Timestamp, - date_range -) + date_range) +import pandas.util.testing as tm class TestDatetimeIndex(object): diff --git a/pandas/tests/indexes/datetimes/test_construction.py b/pandas/tests/indexes/datetimes/test_construction.py index 2fc3e29a47b20b..7a251a8ecfb28f 100644 --- a/pandas/tests/indexes/datetimes/test_construction.py +++ b/pandas/tests/indexes/datetimes/test_construction.py @@ -6,14 +6,14 @@ import pytest import pytz +from pandas._libs.tslib import OutOfBoundsDatetime +from pandas._libs.tslibs import conversion + import pandas as pd -import pandas.util.testing as tm from pandas import ( DatetimeIndex, Index, Timestamp, date_range, datetime, offsets, - to_datetime -) -from pandas._libs.tslib import OutOfBoundsDatetime -from pandas._libs.tslibs import conversion + to_datetime) +import pandas.util.testing as tm class TestDatetimeIndex(object): diff --git a/pandas/tests/indexes/datetimes/test_date_range.py b/pandas/tests/indexes/datetimes/test_date_range.py index 450d7643bfbd5b..b6bab272c8c0aa 100644 --- a/pandas/tests/indexes/datetimes/test_date_range.py +++ b/pandas/tests/indexes/datetimes/test_date_range.py @@ -9,17 +9,17 @@ import pytz from pytz import timezone -import pandas as pd -import pandas.util._test_decorators as td -import pandas.util.testing as tm -from pandas import ( - DatetimeIndex, Timestamp, bdate_range, compat, date_range, offsets -) +import pandas.compat as compat from pandas.errors import OutOfBoundsDatetime +import pandas.util._test_decorators as td + +import pandas as pd +from pandas import DatetimeIndex, Timestamp, bdate_range, date_range, offsets from pandas.tests.series.common import TestData +import pandas.util.testing as tm + from pandas.tseries.offsets import ( - BDay, CDay, DateOffset, MonthEnd, generate_range, prefix_mapping -) + BDay, CDay, DateOffset, MonthEnd, generate_range, prefix_mapping) START, END = datetime(2009, 1, 1), datetime(2010, 1, 1) diff --git a/pandas/tests/indexes/datetimes/test_datetime.py b/pandas/tests/indexes/datetimes/test_datetime.py index 84214b331e8af2..cea56bf8030835 100644 --- a/pandas/tests/indexes/datetimes/test_datetime.py +++ b/pandas/tests/indexes/datetimes/test_datetime.py @@ -1,16 +1,16 @@ -import sys from datetime import date +import sys import dateutil import numpy as np import pytest +from pandas.compat import lrange + import pandas as pd -import pandas.util.testing as tm from pandas import ( - DataFrame, DatetimeIndex, Index, Timestamp, date_range, offsets -) -from pandas.compat import lrange + DataFrame, DatetimeIndex, Index, Timestamp, date_range, offsets) +import pandas.util.testing as tm from pandas.util.testing import assert_almost_equal randn = np.random.randn diff --git a/pandas/tests/indexes/datetimes/test_formats.py b/pandas/tests/indexes/datetimes/test_formats.py index 4279c582e97770..d8e4104919e554 100644 --- a/pandas/tests/indexes/datetimes/test_formats.py +++ b/pandas/tests/indexes/datetimes/test_formats.py @@ -6,8 +6,8 @@ import pytz import pandas as pd -import pandas.util.testing as tm from pandas import DatetimeIndex, Series +import pandas.util.testing as tm def test_to_native_types(): diff --git a/pandas/tests/indexes/datetimes/test_indexing.py b/pandas/tests/indexes/datetimes/test_indexing.py index cb2b0dfe5d11c8..b66475612fe408 100644 --- a/pandas/tests/indexes/datetimes/test_indexing.py +++ b/pandas/tests/indexes/datetimes/test_indexing.py @@ -4,10 +4,12 @@ import pytest import pytz -import pandas as pd import pandas.compat as compat -import pandas.util.testing as tm + +import pandas as pd from pandas import DatetimeIndex, Index, Timestamp, date_range, notna +import pandas.util.testing as tm + from pandas.tseries.offsets import BDay, CDay START, END = datetime(2009, 1, 1), datetime(2010, 1, 1) diff --git a/pandas/tests/indexes/datetimes/test_misc.py b/pandas/tests/indexes/datetimes/test_misc.py index 00d816459626bb..6d6f13bb763f69 100644 --- a/pandas/tests/indexes/datetimes/test_misc.py +++ b/pandas/tests/indexes/datetimes/test_misc.py @@ -6,10 +6,9 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import ( - DatetimeIndex, Index, Timestamp, compat, date_range, datetime, offsets -) + DatetimeIndex, Index, Timestamp, compat, date_range, datetime, offsets) +import pandas.util.testing as tm class TestTimeSeries(object): diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index 086c687148292b..2cb7482cda617d 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -1,17 +1,18 @@ -import warnings from datetime import datetime +import warnings import numpy as np import pytest +from pandas.core.dtypes.generic import ABCDateOffset + import pandas as pd -import pandas.util.testing as tm from pandas import ( DatetimeIndex, Index, PeriodIndex, Series, Timestamp, bdate_range, - date_range -) -from pandas.core.dtypes.generic import ABCDateOffset + date_range) from pandas.tests.test_base import Ops +import pandas.util.testing as tm + from pandas.tseries.offsets import BDay, BMonthEnd, CDay, Day, Hour START, END = datetime(2009, 1, 1), datetime(2010, 1, 1) diff --git a/pandas/tests/indexes/datetimes/test_partial_slicing.py b/pandas/tests/indexes/datetimes/test_partial_slicing.py index ae50ccedd79176..27e53c15238bed 100644 --- a/pandas/tests/indexes/datetimes/test_partial_slicing.py +++ b/pandas/tests/indexes/datetimes/test_partial_slicing.py @@ -1,15 +1,14 @@ """ test partial slicing on Series/Frame """ -import operator as op from datetime import datetime +import operator as op import numpy as np import pytest import pandas as pd from pandas import ( - DataFrame, DatetimeIndex, Index, Series, Timedelta, Timestamp, date_range -) + DataFrame, DatetimeIndex, Index, Series, Timedelta, Timestamp, date_range) from pandas.core.indexing import IndexingError from pandas.util import testing as tm diff --git a/pandas/tests/indexes/datetimes/test_scalar_compat.py b/pandas/tests/indexes/datetimes/test_scalar_compat.py index dac2df520c8e4d..b644cb5844d9b8 100644 --- a/pandas/tests/indexes/datetimes/test_scalar_compat.py +++ b/pandas/tests/indexes/datetimes/test_scalar_compat.py @@ -8,8 +8,9 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import DatetimeIndex, Timestamp, date_range +import pandas.util.testing as tm + from pandas.tseries.frequencies import to_offset diff --git a/pandas/tests/indexes/datetimes/test_setops.py b/pandas/tests/indexes/datetimes/test_setops.py index 896d1cfd0094c1..d72bf275463ac2 100644 --- a/pandas/tests/indexes/datetimes/test_setops.py +++ b/pandas/tests/indexes/datetimes/test_setops.py @@ -3,13 +3,14 @@ import numpy as np import pytest -import pandas as pd import pandas.util._test_decorators as td -import pandas.util.testing as tm + +import pandas as pd from pandas import ( DataFrame, DatetimeIndex, Index, Int64Index, Series, bdate_range, - date_range, to_datetime -) + date_range, to_datetime) +import pandas.util.testing as tm + from pandas.tseries.offsets import BMonthEnd, Minute, MonthEnd START, END = datetime(2009, 1, 1), datetime(2010, 1, 1) diff --git a/pandas/tests/indexes/datetimes/test_timezones.py b/pandas/tests/indexes/datetimes/test_timezones.py index 6309206f48b1a2..9ad540b1744384 100644 --- a/pandas/tests/indexes/datetimes/test_timezones.py +++ b/pandas/tests/indexes/datetimes/test_timezones.py @@ -6,20 +6,20 @@ from distutils.version import LooseVersion import dateutil +from dateutil.tz import gettz, tzlocal import numpy as np import pytest import pytz -from dateutil.tz import gettz, tzlocal -import pandas as pd +from pandas._libs.tslibs import conversion, timezones +from pandas.compat import PY3, lrange, zip import pandas.util._test_decorators as td -import pandas.util.testing as tm + +import pandas as pd from pandas import ( DatetimeIndex, Index, Timestamp, bdate_range, date_range, isna, - to_datetime -) -from pandas._libs.tslibs import conversion, timezones -from pandas.compat import PY3, lrange, zip + to_datetime) +import pandas.util.testing as tm class FixedOffset(tzinfo): diff --git a/pandas/tests/indexes/datetimes/test_tools.py b/pandas/tests/indexes/datetimes/test_tools.py index 428888a0e366d6..ba18f9b34574d3 100644 --- a/pandas/tests/indexes/datetimes/test_tools.py +++ b/pandas/tests/indexes/datetimes/test_tools.py @@ -1,29 +1,30 @@ """ test to_datetime """ import calendar -import locale from datetime import datetime, time from distutils.version import LooseVersion +import locale import dateutil +from dateutil.parser import parse +from dateutil.tz.tz import tzoffset import numpy as np import pytest import pytz -from dateutil.parser import parse -from dateutil.tz.tz import tzoffset -import pandas as pd -import pandas.util._test_decorators as td -from pandas import ( - DataFrame, DatetimeIndex, Index, NaT, Series, Timestamp, compat, - date_range, isna, to_datetime -) from pandas._libs import tslib from pandas._libs.tslibs import parsing from pandas.compat import PY3, lmap +from pandas.errors import OutOfBoundsDatetime +import pandas.util._test_decorators as td + from pandas.core.dtypes.common import is_datetime64_ns_dtype + +import pandas as pd +from pandas import ( + DataFrame, DatetimeIndex, Index, NaT, Series, Timestamp, compat, + date_range, isna, to_datetime) from pandas.core.tools import datetimes as tools -from pandas.errors import OutOfBoundsDatetime from pandas.util import testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/indexes/multi/test_compat.py b/pandas/tests/indexes/multi/test_compat.py index ef3f7ddbbf81dc..f05b53522fa31a 100644 --- a/pandas/tests/indexes/multi/test_compat.py +++ b/pandas/tests/indexes/multi/test_compat.py @@ -4,10 +4,11 @@ import numpy as np import pytest -import pandas.util.testing as tm -from pandas import MultiIndex from pandas.compat import PY3, long +from pandas import MultiIndex +import pandas.util.testing as tm + def test_numeric_compat(idx): tm.assert_raises_regex(TypeError, "cannot perform __mul__", diff --git a/pandas/tests/indexes/multi/test_constructor.py b/pandas/tests/indexes/multi/test_constructor.py index ca9b2766f37981..833de283e5367b 100644 --- a/pandas/tests/indexes/multi/test_constructor.py +++ b/pandas/tests/indexes/multi/test_constructor.py @@ -5,13 +5,15 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import Index, MultiIndex, date_range from pandas._libs.tslib import Timestamp from pandas.compat import lrange, range + from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike +import pandas as pd +from pandas import Index, MultiIndex, date_range +import pandas.util.testing as tm + def test_constructor_single_level(): result = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux']], diff --git a/pandas/tests/indexes/multi/test_contains.py b/pandas/tests/indexes/multi/test_contains.py index c846af3e7cfbe3..deff6aacf8f9cf 100644 --- a/pandas/tests/indexes/multi/test_contains.py +++ b/pandas/tests/indexes/multi/test_contains.py @@ -3,10 +3,11 @@ import numpy as np import pytest +from pandas.compat import PYPY + import pandas as pd -import pandas.util.testing as tm from pandas import MultiIndex -from pandas.compat import PYPY +import pandas.util.testing as tm def test_contains_top_level(): diff --git a/pandas/tests/indexes/multi/test_copy.py b/pandas/tests/indexes/multi/test_copy.py index 99a5bcc1c217bb..0d09e3ef2e4b1c 100644 --- a/pandas/tests/indexes/multi/test_copy.py +++ b/pandas/tests/indexes/multi/test_copy.py @@ -4,8 +4,8 @@ import pytest -import pandas.util.testing as tm from pandas import MultiIndex +import pandas.util.testing as tm def assert_multiindex_copied(copy, original): diff --git a/pandas/tests/indexes/multi/test_equivalence.py b/pandas/tests/indexes/multi/test_equivalence.py index e3af327ededa2f..41cb2409f05329 100644 --- a/pandas/tests/indexes/multi/test_equivalence.py +++ b/pandas/tests/indexes/multi/test_equivalence.py @@ -3,10 +3,11 @@ import numpy as np +from pandas.compat import lrange, lzip, range + import pandas as pd -import pandas.util.testing as tm from pandas import Index, MultiIndex, Series -from pandas.compat import lrange, lzip, range +import pandas.util.testing as tm def test_equals(idx): diff --git a/pandas/tests/indexes/multi/test_get_set.py b/pandas/tests/indexes/multi/test_get_set.py index cac32ce7040b44..e72b76ed072694 100644 --- a/pandas/tests/indexes/multi/test_get_set.py +++ b/pandas/tests/indexes/multi/test_get_set.py @@ -4,10 +4,11 @@ import numpy as np import pytest +from pandas.compat import range + import pandas as pd -import pandas.util.testing as tm from pandas import CategoricalIndex, Index, MultiIndex -from pandas.compat import range +import pandas.util.testing as tm def assert_matching(actual, expected, check_dtype=False): diff --git a/pandas/tests/indexes/multi/test_indexing.py b/pandas/tests/indexes/multi/test_indexing.py index ec83ae4766ab05..2b5f16b0ea0c81 100644 --- a/pandas/tests/indexes/multi/test_indexing.py +++ b/pandas/tests/indexes/multi/test_indexing.py @@ -6,14 +6,14 @@ import numpy as np import pytest +from pandas.compat import lrange + import pandas as pd -import pandas.util.testing as tm from pandas import ( Categorical, CategoricalIndex, Index, IntervalIndex, MultiIndex, - date_range -) -from pandas.compat import lrange + date_range) from pandas.core.indexes.base import InvalidIndexError +import pandas.util.testing as tm from pandas.util.testing import assert_almost_equal diff --git a/pandas/tests/indexes/multi/test_sorting.py b/pandas/tests/indexes/multi/test_sorting.py index b2f12405eb195c..80e2b811ac062d 100644 --- a/pandas/tests/indexes/multi/test_sorting.py +++ b/pandas/tests/indexes/multi/test_sorting.py @@ -2,12 +2,13 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import CategoricalIndex, DataFrame, Index, MultiIndex, RangeIndex from pandas.compat import lrange from pandas.errors import PerformanceWarning, UnsortedIndexError +import pandas as pd +from pandas import CategoricalIndex, DataFrame, Index, MultiIndex, RangeIndex +import pandas.util.testing as tm + def test_sortlevel(idx): import random diff --git a/pandas/tests/indexes/period/test_arithmetic.py b/pandas/tests/indexes/period/test_arithmetic.py index 5864bc0cefcbc3..2c04f22f8b450c 100644 --- a/pandas/tests/indexes/period/test_arithmetic.py +++ b/pandas/tests/indexes/period/test_arithmetic.py @@ -4,8 +4,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import PeriodIndex +import pandas.util.testing as tm class TestPeriodIndexArithmetic(object): diff --git a/pandas/tests/indexes/period/test_astype.py b/pandas/tests/indexes/period/test_astype.py index f254cf2a9cae8f..f7c2bf3d6bf4f0 100644 --- a/pandas/tests/indexes/period/test_astype.py +++ b/pandas/tests/indexes/period/test_astype.py @@ -4,8 +4,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import Index, Int64Index, NaT, Period, PeriodIndex, period_range +import pandas.util.testing as tm class TestPeriodIndexAsType(object): diff --git a/pandas/tests/indexes/period/test_construction.py b/pandas/tests/indexes/period/test_construction.py index cfc6c3b8b0a2e9..9622f47697f8df 100644 --- a/pandas/tests/indexes/period/test_construction.py +++ b/pandas/tests/indexes/period/test_construction.py @@ -1,14 +1,15 @@ import numpy as np import pytest +from pandas.compat import PY3, lmap, lrange, text_type + +from pandas.core.dtypes.dtypes import PeriodDtype + import pandas as pd +from pandas import ( + Index, Period, PeriodIndex, Series, date_range, offsets, period_range) import pandas.core.indexes.period as period import pandas.util.testing as tm -from pandas import ( - Index, Period, PeriodIndex, Series, date_range, offsets, period_range -) -from pandas.compat import PY3, lmap, lrange, text_type -from pandas.core.dtypes.dtypes import PeriodDtype class TestPeriodIndex(object): diff --git a/pandas/tests/indexes/period/test_formats.py b/pandas/tests/indexes/period/test_formats.py index 87211d091e4eac..d4035efa2b866c 100644 --- a/pandas/tests/indexes/period/test_formats.py +++ b/pandas/tests/indexes/period/test_formats.py @@ -2,8 +2,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import PeriodIndex +import pandas.util.testing as tm def test_to_native_types(): diff --git a/pandas/tests/indexes/period/test_indexing.py b/pandas/tests/indexes/period/test_indexing.py index b720f56eeab939..fafba144bb1484 100644 --- a/pandas/tests/indexes/period/test_indexing.py +++ b/pandas/tests/indexes/period/test_indexing.py @@ -3,13 +3,13 @@ import numpy as np import pytest -import pandas as pd -from pandas import ( - DatetimeIndex, Period, PeriodIndex, Series, notna, period_range -) from pandas._libs import tslibs from pandas._libs.tslibs import period as libperiod from pandas.compat import lrange + +import pandas as pd +from pandas import ( + DatetimeIndex, Period, PeriodIndex, Series, notna, period_range) from pandas.util import testing as tm diff --git a/pandas/tests/indexes/period/test_ops.py b/pandas/tests/indexes/period/test_ops.py index 80550292ed4f8f..516eb8971abafc 100644 --- a/pandas/tests/indexes/period/test_ops.py +++ b/pandas/tests/indexes/period/test_ops.py @@ -2,12 +2,13 @@ import numpy as np import pytest -import pandas as pd import pandas._libs.tslib as tslib -import pandas.util.testing as tm + +import pandas as pd from pandas import DatetimeIndex, Index, Period, PeriodIndex, Series from pandas.core.arrays import PeriodArray from pandas.tests.test_base import Ops +import pandas.util.testing as tm class TestPeriodIndexOps(Ops): diff --git a/pandas/tests/indexes/period/test_partial_slicing.py b/pandas/tests/indexes/period/test_partial_slicing.py index eec761395d971c..fcf1156266880f 100644 --- a/pandas/tests/indexes/period/test_partial_slicing.py +++ b/pandas/tests/indexes/period/test_partial_slicing.py @@ -3,8 +3,7 @@ import pandas as pd from pandas import ( - DataFrame, DatetimeIndex, Period, PeriodIndex, Series, period_range -) + DataFrame, DatetimeIndex, Period, PeriodIndex, Series, period_range) from pandas.util import testing as tm diff --git a/pandas/tests/indexes/period/test_period.py b/pandas/tests/indexes/period/test_period.py index 300d5ef609b3ef..8b2e91450c8c0d 100644 --- a/pandas/tests/indexes/period/test_period.py +++ b/pandas/tests/indexes/period/test_period.py @@ -1,12 +1,12 @@ import numpy as np import pytest -import pandas as pd import pandas.util._test_decorators as td + +import pandas as pd from pandas import ( DataFrame, DatetimeIndex, Index, NaT, Period, PeriodIndex, Series, - date_range, offsets, period_range -) + date_range, offsets, period_range) from pandas.util import testing as tm from ..datetimelike import DatetimeLike diff --git a/pandas/tests/indexes/period/test_period_range.py b/pandas/tests/indexes/period/test_period_range.py index fd8d2f94c17991..11d38df1dd49cd 100644 --- a/pandas/tests/indexes/period/test_period_range.py +++ b/pandas/tests/indexes/period/test_period_range.py @@ -1,7 +1,7 @@ import pytest -import pandas.util.testing as tm from pandas import NaT, Period, PeriodIndex, date_range, period_range +import pandas.util.testing as tm class TestPeriodRange(object): diff --git a/pandas/tests/indexes/period/test_scalar_compat.py b/pandas/tests/indexes/period/test_scalar_compat.py index 48c1d5b8dd7063..01fb1e3dc7e022 100644 --- a/pandas/tests/indexes/period/test_scalar_compat.py +++ b/pandas/tests/indexes/period/test_scalar_compat.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """Tests for PeriodIndex behaving like a vectorized Period scalar""" -import pandas.util.testing as tm from pandas import PeriodIndex, Timedelta, date_range +import pandas.util.testing as tm class TestPeriodIndexOps(object): diff --git a/pandas/tests/indexes/period/test_setops.py b/pandas/tests/indexes/period/test_setops.py index 479104fedcf745..c4dd23b1708db6 100644 --- a/pandas/tests/indexes/period/test_setops.py +++ b/pandas/tests/indexes/period/test_setops.py @@ -2,9 +2,9 @@ import pytest import pandas as pd +from pandas import Index, PeriodIndex, date_range, period_range import pandas.core.indexes.period as period import pandas.util.testing as tm -from pandas import Index, PeriodIndex, date_range, period_range def _permute(obj): diff --git a/pandas/tests/indexes/period/test_tools.py b/pandas/tests/indexes/period/test_tools.py index 2919b97da58254..8d09273bde63de 100644 --- a/pandas/tests/indexes/period/test_tools.py +++ b/pandas/tests/indexes/period/test_tools.py @@ -3,15 +3,15 @@ import numpy as np import pytest +from pandas._libs.tslibs.ccalendar import MONTHS +from pandas.compat import lrange + import pandas as pd -import pandas.core.indexes.period as period -import pandas.util.testing as tm from pandas import ( DatetimeIndex, Period, PeriodIndex, Series, Timedelta, Timestamp, - date_range, period_range, to_datetime -) -from pandas._libs.tslibs.ccalendar import MONTHS -from pandas.compat import lrange + date_range, period_range, to_datetime) +import pandas.core.indexes.period as period +import pandas.util.testing as tm class TestPeriodRepresentation(object): diff --git a/pandas/tests/indexes/test_numeric.py b/pandas/tests/indexes/test_numeric.py index 6f151134bd24ff..8373cbc89149ac 100644 --- a/pandas/tests/indexes/test_numeric.py +++ b/pandas/tests/indexes/test_numeric.py @@ -5,12 +5,13 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import Float64Index, Index, Int64Index, Series, UInt64Index from pandas._libs.tslibs import Timestamp from pandas.compat import range + +import pandas as pd +from pandas import Float64Index, Index, Int64Index, Series, UInt64Index from pandas.tests.indexes.common import Base +import pandas.util.testing as tm class Numeric(Base): diff --git a/pandas/tests/indexes/test_range.py b/pandas/tests/indexes/test_range.py index 4bd66c070e731a..ecda48822eb0f5 100644 --- a/pandas/tests/indexes/test_range.py +++ b/pandas/tests/indexes/test_range.py @@ -1,16 +1,17 @@ # -*- coding: utf-8 -*- -import operator from datetime import datetime from itertools import combinations +import operator import numpy as np import pytest +from pandas.compat import PY3, range, u + import pandas as pd -import pandas.util.testing as tm from pandas import Float64Index, Index, Int64Index, RangeIndex, Series, isna -from pandas.compat import PY3, range, u +import pandas.util.testing as tm from .test_numeric import Numeric diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 1fd9bf86ff6ee1..5053c7f3d9875b 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -6,15 +6,17 @@ import numpy as np import pytest -from pandas import ( - DataFrame, Float64Index, MultiIndex, Panel, Series, UInt64Index, - date_range -) from pandas.compat import lrange + from pandas.core.dtypes.common import is_scalar -from pandas.io.formats.printing import pprint_thing + +from pandas import ( + DataFrame, Float64Index, MultiIndex, Panel, Series, UInt64Index, + date_range) from pandas.util import testing as tm +from pandas.io.formats.printing import pprint_thing + _verbose = False diff --git a/pandas/tests/indexing/interval/test_interval.py b/pandas/tests/indexing/interval/test_interval.py index 67fa31637fc257..938caec006f3a0 100644 --- a/pandas/tests/indexing/interval/test_interval.py +++ b/pandas/tests/indexing/interval/test_interval.py @@ -2,8 +2,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import DataFrame, Interval, IntervalIndex, Series +import pandas.util.testing as tm class TestIntervalIndex(object): diff --git a/pandas/tests/indexing/interval/test_interval_new.py b/pandas/tests/indexing/interval/test_interval_new.py index 080f2abdad7dee..4b2ec0c4d17bf9 100644 --- a/pandas/tests/indexing/interval/test_interval_new.py +++ b/pandas/tests/indexing/interval/test_interval_new.py @@ -1,8 +1,8 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import Interval, IntervalIndex, Series +import pandas.util.testing as tm pytestmark = pytest.mark.skip(reason="new indexing tests for issue 16316") diff --git a/pandas/tests/indexing/test_categorical.py b/pandas/tests/indexing/test_categorical.py index 85f95e79cc003f..3a235e1eeb0dc9 100644 --- a/pandas/tests/indexing/test_categorical.py +++ b/pandas/tests/indexing/test_categorical.py @@ -3,15 +3,16 @@ import numpy as np import pytest -import pandas as pd import pandas.compat as compat + +from pandas.core.dtypes.common import is_categorical_dtype +from pandas.core.dtypes.dtypes import CategoricalDtype + +import pandas as pd from pandas import ( Categorical, CategoricalIndex, DataFrame, Index, Interval, Series, - Timestamp -) + Timestamp) from pandas.api.types import CategoricalDtype as CDT -from pandas.core.dtypes.common import is_categorical_dtype -from pandas.core.dtypes.dtypes import CategoricalDtype from pandas.util import testing as tm from pandas.util.testing import assert_frame_equal, assert_series_equal diff --git a/pandas/tests/indexing/test_chaining_and_caching.py b/pandas/tests/indexing/test_chaining_and_caching.py index 3762585558082c..71fec75f9a7d3a 100644 --- a/pandas/tests/indexing/test_chaining_and_caching.py +++ b/pandas/tests/indexing/test_chaining_and_caching.py @@ -4,8 +4,7 @@ import pandas as pd from pandas import ( DataFrame, MultiIndex, Series, Timestamp, compat, date_range, - option_context -) + option_context) from pandas.core import common as com from pandas.util import testing as tm diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index 643b6081d176a2..65110d49552944 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -5,8 +5,9 @@ import numpy as np import pytest -import pandas as pd import pandas.compat as compat + +import pandas as pd import pandas.util.testing as tm ############################################################### diff --git a/pandas/tests/indexing/test_datetime.py b/pandas/tests/indexing/test_datetime.py index 5fd1724f6e95c1..11fb90ebd9bb9b 100644 --- a/pandas/tests/indexing/test_datetime.py +++ b/pandas/tests/indexing/test_datetime.py @@ -1,7 +1,7 @@ from datetime import datetime, timedelta -import numpy as np from dateutil import tz +import numpy as np import pandas as pd from pandas import DataFrame, Index, Series, Timestamp, date_range diff --git a/pandas/tests/indexing/test_floats.py b/pandas/tests/indexing/test_floats.py index c7fe9959b048a4..0a55b3f67dd3f8 100644 --- a/pandas/tests/indexing/test_floats.py +++ b/pandas/tests/indexing/test_floats.py @@ -5,10 +5,9 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import ( - DataFrame, Float64Index, Index, Int64Index, RangeIndex, Series -) + DataFrame, Float64Index, Index, Int64Index, RangeIndex, Series) +import pandas.util.testing as tm from pandas.util.testing import assert_almost_equal, assert_series_equal ignore_ix = pytest.mark.filterwarnings("ignore:\\n.ix:DeprecationWarning") diff --git a/pandas/tests/indexing/test_iloc.py b/pandas/tests/indexing/test_iloc.py index e2b6a37096493f..6d0b516d8ebf00 100644 --- a/pandas/tests/indexing/test_iloc.py +++ b/pandas/tests/indexing/test_iloc.py @@ -5,10 +5,11 @@ import numpy as np import pytest +from pandas.compat import lmap, lrange + import pandas as pd from pandas import DataFrame, Series, concat, date_range, isna from pandas.api.types import is_scalar -from pandas.compat import lmap, lrange from pandas.tests.indexing.common import Base from pandas.util import testing as tm diff --git a/pandas/tests/indexing/test_indexing.py b/pandas/tests/indexing/test_indexing.py index e96e249743468a..3b95ba8e4b9d87 100644 --- a/pandas/tests/indexing/test_indexing.py +++ b/pandas/tests/indexing/test_indexing.py @@ -3,22 +3,23 @@ """ test fancy indexing & misc """ -import weakref from datetime import datetime from warnings import catch_warnings, simplefilter +import weakref import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import DataFrame, Index, MultiIndex, NaT, Series from pandas.compat import PY2, StringIO, lrange, lzip, range + from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype + +import pandas as pd +from pandas import DataFrame, Index, MultiIndex, NaT, Series from pandas.core.indexing import ( - _maybe_numeric_slice, _non_reducing_slice, validate_indices -) + _maybe_numeric_slice, _non_reducing_slice, validate_indices) from pandas.tests.indexing.common import Base, _mklbl +import pandas.util.testing as tm # ------------------------------------------------------------------------ # Indexing test cases diff --git a/pandas/tests/indexing/test_indexing_engines.py b/pandas/tests/indexing/test_indexing_engines.py index 410eba99948ce1..dcdfbcb7fbea2d 100644 --- a/pandas/tests/indexing/test_indexing_engines.py +++ b/pandas/tests/indexing/test_indexing_engines.py @@ -1,9 +1,10 @@ import numpy as np -import pandas.util.testing as tm -from pandas import compat from pandas._libs import algos as libalgos, index as libindex +from pandas import compat +import pandas.util.testing as tm + class TestNumericEngine(object): def test_is_monotonic(self, numeric_indexing_engine_type_and_dtype): diff --git a/pandas/tests/indexing/test_indexing_slow.py b/pandas/tests/indexing/test_indexing_slow.py index 9715fc2bb5946b..5fd1431ac210c8 100644 --- a/pandas/tests/indexing/test_indexing_slow.py +++ b/pandas/tests/indexing/test_indexing_slow.py @@ -6,8 +6,8 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas.core.api import DataFrame, MultiIndex, Series +import pandas.util.testing as tm class TestIndexingSlow(object): diff --git a/pandas/tests/indexing/test_ix.py b/pandas/tests/indexing/test_ix.py index 0e99be31f6b933..850f80241a4776 100644 --- a/pandas/tests/indexing/test_ix.py +++ b/pandas/tests/indexing/test_ix.py @@ -5,11 +5,13 @@ import numpy as np import pytest -import pandas as pd -from pandas import DataFrame, MultiIndex, Series, option_context from pandas.compat import lrange -from pandas.core.dtypes.common import is_scalar from pandas.errors import PerformanceWarning + +from pandas.core.dtypes.common import is_scalar + +import pandas as pd +from pandas import DataFrame, MultiIndex, Series, option_context from pandas.util import testing as tm diff --git a/pandas/tests/indexing/test_loc.py b/pandas/tests/indexing/test_loc.py index 9314c2bcc84158..df0180c7a5bf74 100644 --- a/pandas/tests/indexing/test_loc.py +++ b/pandas/tests/indexing/test_loc.py @@ -6,10 +6,11 @@ import numpy as np import pytest +from pandas.compat import PY2, StringIO, lrange + import pandas as pd from pandas import DataFrame, Index, MultiIndex, Series, Timestamp, date_range from pandas.api.types import is_scalar -from pandas.compat import PY2, StringIO, lrange from pandas.tests.indexing.common import Base from pandas.util import testing as tm diff --git a/pandas/tests/indexing/test_multiindex.py b/pandas/tests/indexing/test_multiindex.py index 42d7b35a0a2fdb..dcf148f199d52c 100644 --- a/pandas/tests/indexing/test_multiindex.py +++ b/pandas/tests/indexing/test_multiindex.py @@ -3,11 +3,11 @@ import numpy as np import pytest +from pandas.errors import PerformanceWarning, UnsortedIndexError + import pandas as pd from pandas import ( - DataFrame, Index, MultiIndex, Panel, Series, Timestamp, date_range -) -from pandas.errors import PerformanceWarning, UnsortedIndexError + DataFrame, Index, MultiIndex, Panel, Series, Timestamp, date_range) from pandas.tests.indexing.common import _mklbl from pandas.util import testing as tm diff --git a/pandas/tests/io/parser/c_parser_only.py b/pandas/tests/io/parser/c_parser_only.py index 7769b62dc02066..edcfe1c0768cd3 100644 --- a/pandas/tests/io/parser/c_parser_only.py +++ b/pandas/tests/io/parser/c_parser_only.py @@ -14,11 +14,12 @@ import numpy as np import pytest -import pandas as pd +from pandas.compat import StringIO, lrange, range import pandas.util._test_decorators as td -import pandas.util.testing as tm + +import pandas as pd from pandas import DataFrame -from pandas.compat import StringIO, lrange, range +import pandas.util.testing as tm class CParserTests(object): diff --git a/pandas/tests/io/parser/comment.py b/pandas/tests/io/parser/comment.py index c71f92d8fb1be1..fc2310ca1daaf3 100644 --- a/pandas/tests/io/parser/comment.py +++ b/pandas/tests/io/parser/comment.py @@ -7,10 +7,11 @@ import numpy as np -import pandas.util.testing as tm -from pandas import DataFrame from pandas.compat import StringIO +from pandas import DataFrame +import pandas.util.testing as tm + class CommentTests(object): diff --git a/pandas/tests/io/parser/common.py b/pandas/tests/io/parser/common.py index 82557815ed5cfd..da8118ef3e1234 100644 --- a/pandas/tests/io/parser/common.py +++ b/pandas/tests/io/parser/common.py @@ -1,24 +1,26 @@ # -*- coding: utf-8 -*- import codecs +from collections import OrderedDict import csv +from datetime import datetime +from io import TextIOWrapper import os import platform import re import sys -from collections import OrderedDict -from datetime import datetime -from io import TextIOWrapper import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import DataFrame, Index, MultiIndex, Series, compat from pandas._libs.tslib import Timestamp from pandas.compat import PY3, BytesIO, StringIO, lrange, range, u from pandas.errors import DtypeWarning, EmptyDataError, ParserError + +import pandas as pd +from pandas import DataFrame, Index, MultiIndex, Series, compat +import pandas.util.testing as tm + from pandas.io.common import URLError from pandas.io.parsers import TextFileReader, TextParser diff --git a/pandas/tests/io/parser/compression.py b/pandas/tests/io/parser/compression.py index 5efed89663e0fe..2d32e383c7fee6 100644 --- a/pandas/tests/io/parser/compression.py +++ b/pandas/tests/io/parser/compression.py @@ -10,9 +10,10 @@ import pytest -import pandas as pd import pandas.compat as compat import pandas.util._test_decorators as td + +import pandas as pd import pandas.util.testing as tm try: diff --git a/pandas/tests/io/parser/converters.py b/pandas/tests/io/parser/converters.py index be14e7be0ab9b3..f17ad019469aba 100644 --- a/pandas/tests/io/parser/converters.py +++ b/pandas/tests/io/parser/converters.py @@ -10,12 +10,13 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import DataFrame, Index from pandas._libs.tslib import Timestamp from pandas.compat import StringIO, lmap, parse_date +import pandas as pd +from pandas import DataFrame, Index +import pandas.util.testing as tm + class ConverterTests(object): diff --git a/pandas/tests/io/parser/dialect.py b/pandas/tests/io/parser/dialect.py index 2a519a0083f407..480ce9ef361d09 100644 --- a/pandas/tests/io/parser/dialect.py +++ b/pandas/tests/io/parser/dialect.py @@ -7,11 +7,12 @@ import csv -import pandas.util.testing as tm -from pandas import DataFrame from pandas.compat import StringIO from pandas.errors import ParserWarning +from pandas import DataFrame +import pandas.util.testing as tm + class DialectTests(object): diff --git a/pandas/tests/io/parser/dtypes.py b/pandas/tests/io/parser/dtypes.py index 00dfb616c18cae..950795b33d4609 100644 --- a/pandas/tests/io/parser/dtypes.py +++ b/pandas/tests/io/parser/dtypes.py @@ -8,13 +8,15 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import Categorical, DataFrame, Index, MultiIndex, Series from pandas.compat import StringIO -from pandas.core.dtypes.dtypes import CategoricalDtype from pandas.errors import ParserWarning +from pandas.core.dtypes.dtypes import CategoricalDtype + +import pandas as pd +from pandas import Categorical, DataFrame, Index, MultiIndex, Series +import pandas.util.testing as tm + class DtypeTests(object): diff --git a/pandas/tests/io/parser/header.py b/pandas/tests/io/parser/header.py index ced59fe1696d62..3a6db0fafa7c6f 100644 --- a/pandas/tests/io/parser/header.py +++ b/pandas/tests/io/parser/header.py @@ -10,10 +10,11 @@ import numpy as np import pytest -import pandas.util.testing as tm -from pandas import DataFrame, Index, MultiIndex from pandas.compat import StringIO, lrange, u +from pandas import DataFrame, Index, MultiIndex +import pandas.util.testing as tm + class HeaderTests(object): diff --git a/pandas/tests/io/parser/index_col.py b/pandas/tests/io/parser/index_col.py index 973fa4c57545a8..2909ef6214e621 100644 --- a/pandas/tests/io/parser/index_col.py +++ b/pandas/tests/io/parser/index_col.py @@ -8,10 +8,11 @@ import pytest -import pandas.util.testing as tm -from pandas import DataFrame, Index, MultiIndex from pandas.compat import StringIO +from pandas import DataFrame, Index, MultiIndex +import pandas.util.testing as tm + class IndexColTests(object): diff --git a/pandas/tests/io/parser/mangle_dupes.py b/pandas/tests/io/parser/mangle_dupes.py index d043f644600281..1ebfa9cb0f6454 100644 --- a/pandas/tests/io/parser/mangle_dupes.py +++ b/pandas/tests/io/parser/mangle_dupes.py @@ -6,10 +6,11 @@ de-duplicated (if mangling requested) or ignored otherwise. """ -import pandas.util.testing as tm -from pandas import DataFrame from pandas.compat import StringIO +from pandas import DataFrame +import pandas.util.testing as tm + class DupeColumnTests(object): def test_basic(self): diff --git a/pandas/tests/io/parser/multithread.py b/pandas/tests/io/parser/multithread.py index dee7067ea87286..0be3a429f5f649 100644 --- a/pandas/tests/io/parser/multithread.py +++ b/pandas/tests/io/parser/multithread.py @@ -11,10 +11,11 @@ import numpy as np +from pandas.compat import BytesIO, range + import pandas as pd -import pandas.util.testing as tm from pandas import DataFrame -from pandas.compat import BytesIO, range +import pandas.util.testing as tm def _construct_dataframe(num_rows): diff --git a/pandas/tests/io/parser/na_values.py b/pandas/tests/io/parser/na_values.py index 392f4de2ecaaf2..5e67b62879acbc 100644 --- a/pandas/tests/io/parser/na_values.py +++ b/pandas/tests/io/parser/na_values.py @@ -6,14 +6,16 @@ """ import numpy as np -import pytest from numpy import nan +import pytest -import pandas.io.common as com -import pandas.util.testing as tm -from pandas import DataFrame, Index, MultiIndex from pandas.compat import StringIO, range +from pandas import DataFrame, Index, MultiIndex +import pandas.util.testing as tm + +import pandas.io.common as com + class NAvaluesTests(object): diff --git a/pandas/tests/io/parser/parse_dates.py b/pandas/tests/io/parser/parse_dates.py index d893b91226976e..4c2c5b754f9bb0 100644 --- a/pandas/tests/io/parser/parse_dates.py +++ b/pandas/tests/io/parser/parse_dates.py @@ -12,16 +12,19 @@ import pytest import pytz -import pandas as pd -import pandas.io.date_converters as conv -import pandas.io.parsers as parsers -import pandas.util.testing as tm -from pandas import DataFrame, DatetimeIndex, Index, MultiIndex, Series, compat from pandas._libs.tslib import Timestamp from pandas._libs.tslibs import parsing +import pandas.compat as compat from pandas.compat import StringIO, lrange, parse_date from pandas.compat.numpy import np_array_datetime64_compat + +import pandas as pd +from pandas import DataFrame, DatetimeIndex, Index, MultiIndex, Series from pandas.core.indexes.datetimes import date_range +import pandas.util.testing as tm + +import pandas.io.date_converters as conv +import pandas.io.parsers as parsers class ParseDatesTests(object): diff --git a/pandas/tests/io/parser/python_parser_only.py b/pandas/tests/io/parser/python_parser_only.py index 5d2f6b7231a5d5..c3c87bca24a473 100644 --- a/pandas/tests/io/parser/python_parser_only.py +++ b/pandas/tests/io/parser/python_parser_only.py @@ -11,11 +11,13 @@ import pytest -import pandas.util.testing as tm -from pandas import DataFrame, Index, compat +import pandas.compat as compat from pandas.compat import BytesIO, StringIO, u from pandas.errors import ParserError +from pandas import DataFrame, Index +import pandas.util.testing as tm + class PythonParserTests(object): diff --git a/pandas/tests/io/parser/quoting.py b/pandas/tests/io/parser/quoting.py index 27ee824cd2556a..270a5430e6da40 100644 --- a/pandas/tests/io/parser/quoting.py +++ b/pandas/tests/io/parser/quoting.py @@ -7,11 +7,12 @@ import csv -import pandas.util.testing as tm -from pandas import DataFrame from pandas.compat import PY3, StringIO, u from pandas.errors import ParserError +from pandas import DataFrame +import pandas.util.testing as tm + class QuotingTests(object): diff --git a/pandas/tests/io/parser/skiprows.py b/pandas/tests/io/parser/skiprows.py index 89a7b5fd0ea1f1..5d1b3b207a2402 100644 --- a/pandas/tests/io/parser/skiprows.py +++ b/pandas/tests/io/parser/skiprows.py @@ -9,11 +9,12 @@ import numpy as np -import pandas.util.testing as tm -from pandas import DataFrame from pandas.compat import StringIO, lrange, range from pandas.errors import EmptyDataError +from pandas import DataFrame +import pandas.util.testing as tm + class SkipRowsTests(object): diff --git a/pandas/tests/io/parser/test_network.py b/pandas/tests/io/parser/test_network.py index 8b8bf3a339d85d..e54da94089cfdf 100644 --- a/pandas/tests/io/parser/test_network.py +++ b/pandas/tests/io/parser/test_network.py @@ -9,10 +9,12 @@ import numpy as np import pytest +from pandas.compat import BytesIO, StringIO import pandas.util._test_decorators as td -import pandas.util.testing as tm + from pandas import DataFrame -from pandas.compat import BytesIO, StringIO +import pandas.util.testing as tm + from pandas.io.parsers import read_csv diff --git a/pandas/tests/io/parser/test_parsers.py b/pandas/tests/io/parser/test_parsers.py index 00879c096aa501..50d927176a7b47 100644 --- a/pandas/tests/io/parser/test_parsers.py +++ b/pandas/tests/io/parser/test_parsers.py @@ -4,12 +4,13 @@ import pytest -import pandas.core.common as com -import pandas.util.testing as tm -from pandas import DataFrame, read_csv, read_table from pandas._libs.tslib import Timestamp from pandas.compat import StringIO +from pandas import DataFrame, read_csv, read_table +import pandas.core.common as com +import pandas.util.testing as tm + from .c_parser_only import CParserTests from .comment import CommentTests from .common import ParserTests diff --git a/pandas/tests/io/parser/test_read_fwf.py b/pandas/tests/io/parser/test_read_fwf.py index 468640ae327bbf..f7846f7824ba50 100644 --- a/pandas/tests/io/parser/test_read_fwf.py +++ b/pandas/tests/io/parser/test_read_fwf.py @@ -11,10 +11,13 @@ import numpy as np import pytest +import pandas.compat as compat +from pandas.compat import BytesIO, StringIO + import pandas as pd +from pandas import DataFrame import pandas.util.testing as tm -from pandas import DataFrame, compat -from pandas.compat import BytesIO, StringIO + from pandas.io.parsers import EmptyDataError, read_csv, read_fwf diff --git a/pandas/tests/io/parser/test_textreader.py b/pandas/tests/io/parser/test_textreader.py index 94c69bbbb8d5f5..93c115ae0a57b3 100644 --- a/pandas/tests/io/parser/test_textreader.py +++ b/pandas/tests/io/parser/test_textreader.py @@ -9,17 +9,20 @@ import sys import numpy as np -import pytest from numpy import nan +import pytest import pandas._libs.parsers as parser -import pandas.util.testing as tm -from pandas import DataFrame, compat from pandas._libs.parsers import TextReader +import pandas.compat as compat from pandas.compat import BytesIO, StringIO, map -from pandas.io.parsers import TextFileReader, read_csv + +from pandas import DataFrame +import pandas.util.testing as tm from pandas.util.testing import assert_frame_equal +from pandas.io.parsers import TextFileReader, read_csv + class TestTextReader(object): diff --git a/pandas/tests/io/parser/test_unsupported.py b/pandas/tests/io/parser/test_unsupported.py index c6fd2501167791..4437b0db9054e2 100644 --- a/pandas/tests/io/parser/test_unsupported.py +++ b/pandas/tests/io/parser/test_unsupported.py @@ -11,10 +11,12 @@ import pytest -import pandas.io.parsers as parsers -import pandas.util.testing as tm from pandas.compat import StringIO from pandas.errors import ParserError + +import pandas.util.testing as tm + +import pandas.io.parsers as parsers from pandas.io.parsers import read_csv diff --git a/pandas/tests/io/parser/usecols.py b/pandas/tests/io/parser/usecols.py index 5fd2dc3f48e3ec..82d45b163d16a9 100644 --- a/pandas/tests/io/parser/usecols.py +++ b/pandas/tests/io/parser/usecols.py @@ -8,11 +8,12 @@ import numpy as np import pytest -import pandas.util.testing as tm -from pandas import DataFrame, Index from pandas._libs.tslib import Timestamp from pandas.compat import StringIO +from pandas import DataFrame, Index +import pandas.util.testing as tm + class UsecolsTests(object): msg_validate_usecols_arg = ("'usecols' must either be list-like of all " diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index 7b9e23fca59aab..c6b6f6cab9ddd5 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -15,7 +15,7 @@ import pandas as pd import pandas.util.testing as tm -from pandas import compat +import pandas.compat as compat from pandas.compat import iterkeys from pandas.core.dtypes.common import is_categorical_dtype from pandas.core.frame import DataFrame, Series diff --git a/pandas/tests/scalar/interval/test_ops.py b/pandas/tests/scalar/interval/test_ops.py index cfd9fc34faeff3..7eca24aa8af25a 100644 --- a/pandas/tests/scalar/interval/test_ops.py +++ b/pandas/tests/scalar/interval/test_ops.py @@ -1,8 +1,8 @@ """Tests for Interval-Interval operations, such as overlaps, contains, etc.""" import pytest -import pandas.util.testing as tm from pandas import Interval, Timedelta, Timestamp +import pandas.util.testing as tm @pytest.fixture(params=[ diff --git a/pandas/tests/series/common.py b/pandas/tests/series/common.py index ec7558e41ab40e..cacca38b2d6083 100644 --- a/pandas/tests/series/common.py +++ b/pandas/tests/series/common.py @@ -1,6 +1,7 @@ +from pandas.util._decorators import cache_readonly + import pandas as pd import pandas.util.testing as tm -from pandas.util._decorators import cache_readonly _ts = tm.makeTimeSeries() diff --git a/pandas/tests/series/conftest.py b/pandas/tests/series/conftest.py index 352e4df54fe5b3..431aacb1c8d568 100644 --- a/pandas/tests/series/conftest.py +++ b/pandas/tests/series/conftest.py @@ -1,7 +1,7 @@ import pytest -import pandas.util.testing as tm from pandas import Series +import pandas.util.testing as tm @pytest.fixture diff --git a/pandas/tests/series/indexing/test_alter_index.py b/pandas/tests/series/indexing/test_alter_index.py index ea6788a1a36ee1..25c930e8cade6c 100644 --- a/pandas/tests/series/indexing/test_alter_index.py +++ b/pandas/tests/series/indexing/test_alter_index.py @@ -4,13 +4,15 @@ from datetime import datetime import numpy as np -import pytest from numpy import nan +import pytest + +import pandas.compat as compat +from pandas.compat import lrange, range import pandas as pd +from pandas import Categorical, Series, date_range, isna import pandas.util.testing as tm -from pandas import Categorical, Series, compat, date_range, isna -from pandas.compat import lrange, range from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/indexing/test_boolean.py b/pandas/tests/series/indexing/test_boolean.py index df92851f432278..5d1b81ba7dc1c9 100644 --- a/pandas/tests/series/indexing/test_boolean.py +++ b/pandas/tests/series/indexing/test_boolean.py @@ -4,15 +4,18 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import Index, Series, Timestamp, date_range, isna from pandas.compat import lrange, range + from pandas.core.dtypes.common import is_integer + +import pandas as pd +from pandas import Index, Series, Timestamp, date_range, isna from pandas.core.indexing import IndexingError -from pandas.tseries.offsets import BDay +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal +from pandas.tseries.offsets import BDay + def test_getitem_boolean(test_data): s = test_data.series diff --git a/pandas/tests/series/indexing/test_datetime.py b/pandas/tests/series/indexing/test_datetime.py index d63150165d7d35..a0da25c96caa6e 100644 --- a/pandas/tests/series/indexing/test_datetime.py +++ b/pandas/tests/series/indexing/test_datetime.py @@ -6,15 +6,15 @@ import numpy as np import pytest -import pandas as pd -import pandas._libs.index as _index -import pandas.util.testing as tm -from pandas import DataFrame, DatetimeIndex, NaT, Series, Timestamp, date_range from pandas._libs import tslib +import pandas._libs.index as _index from pandas.compat import lrange, range + +import pandas as pd +from pandas import DataFrame, DatetimeIndex, NaT, Series, Timestamp, date_range +import pandas.util.testing as tm from pandas.util.testing import ( - assert_almost_equal, assert_frame_equal, assert_series_equal -) + assert_almost_equal, assert_frame_equal, assert_series_equal) """ diff --git a/pandas/tests/series/indexing/test_iloc.py b/pandas/tests/series/indexing/test_iloc.py index 64ef2078cbe789..fa85da6a70d62f 100644 --- a/pandas/tests/series/indexing/test_iloc.py +++ b/pandas/tests/series/indexing/test_iloc.py @@ -3,8 +3,9 @@ import numpy as np -from pandas import Series from pandas.compat import lrange, range + +from pandas import Series from pandas.util.testing import assert_almost_equal, assert_series_equal diff --git a/pandas/tests/series/indexing/test_indexing.py b/pandas/tests/series/indexing/test_indexing.py index e926e477d0bc40..1582bd119c806c 100644 --- a/pandas/tests/series/indexing/test_indexing.py +++ b/pandas/tests/series/indexing/test_indexing.py @@ -8,16 +8,18 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import ( - Categorical, DataFrame, MultiIndex, Series, Timedelta, Timestamp -) from pandas.compat import lrange, range + from pandas.core.dtypes.common import is_scalar -from pandas.tseries.offsets import BDay + +import pandas as pd +from pandas import ( + Categorical, DataFrame, MultiIndex, Series, Timedelta, Timestamp) +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal +from pandas.tseries.offsets import BDay + def test_basic_indexing(): s = Series(np.random.randn(5), index=['a', 'b', 'a', 'a', 'b']) diff --git a/pandas/tests/series/indexing/test_loc.py b/pandas/tests/series/indexing/test_loc.py index 596b5d022c68df..36c26267ecd5f3 100644 --- a/pandas/tests/series/indexing/test_loc.py +++ b/pandas/tests/series/indexing/test_loc.py @@ -4,9 +4,10 @@ import numpy as np import pytest +from pandas.compat import lrange + import pandas as pd from pandas import Series, Timestamp -from pandas.compat import lrange from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/indexing/test_numeric.py b/pandas/tests/series/indexing/test_numeric.py index 0b61274801de1f..da0e15b8a96fc7 100644 --- a/pandas/tests/series/indexing/test_numeric.py +++ b/pandas/tests/series/indexing/test_numeric.py @@ -4,10 +4,11 @@ import numpy as np import pytest +from pandas.compat import lrange, range + import pandas as pd -import pandas.util.testing as tm from pandas import DataFrame, Index, Series -from pandas.compat import lrange, range +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/test_alter_axes.py b/pandas/tests/series/test_alter_axes.py index 5193307a3c256d..be3d0cd6d929c3 100644 --- a/pandas/tests/series/test_alter_axes.py +++ b/pandas/tests/series/test_alter_axes.py @@ -6,10 +6,11 @@ import numpy as np import pytest -import pandas.util.testing as tm -from pandas import DataFrame, Index, MultiIndex, RangeIndex, Series from pandas.compat import lrange, range, zip +from pandas import DataFrame, Index, MultiIndex, RangeIndex, Series +import pandas.util.testing as tm + class TestSeriesAlterAxes(object): diff --git a/pandas/tests/series/test_analytics.py b/pandas/tests/series/test_analytics.py index c84cf2ee50e4b6..3f14c80e77dd03 100644 --- a/pandas/tests/series/test_analytics.py +++ b/pandas/tests/series/test_analytics.py @@ -1,30 +1,29 @@ # coding=utf-8 # pylint: disable-msg=E1101,W0612 -import operator from distutils.version import LooseVersion from itertools import product +import operator import numpy as np -import pytest from numpy import nan +import pytest -import pandas as pd -import pandas.core.nanops as nanops +from pandas.compat import PY35, lrange, range import pandas.util._test_decorators as td -import pandas.util.testing as tm + +import pandas as pd from pandas import ( Categorical, CategoricalIndex, DataFrame, Series, bdate_range, compat, - date_range, isna, notna -) -from pandas.compat import PY35, lrange, range + date_range, isna, notna) from pandas.core.index import MultiIndex from pandas.core.indexes.datetimes import Timestamp from pandas.core.indexes.timedeltas import Timedelta +import pandas.core.nanops as nanops +import pandas.util.testing as tm from pandas.util.testing import ( assert_almost_equal, assert_frame_equal, assert_index_equal, - assert_series_equal -) + assert_series_equal) from .common import TestData diff --git a/pandas/tests/series/test_api.py b/pandas/tests/series/test_api.py index 32181fe3dad39d..bd0d02014dcdb4 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -1,24 +1,26 @@ # coding=utf-8 # pylint: disable-msg=E1101,W0612 +from collections import OrderedDict import pydoc import warnings -from collections import OrderedDict import numpy as np import pytest +import pandas.compat as compat +from pandas.compat import isidentifier, lzip, range, string_types + import pandas as pd -import pandas.io.formats.printing as printing -import pandas.util.testing as tm from pandas import ( Categorical, DataFrame, DatetimeIndex, Index, Series, TimedeltaIndex, - compat, date_range, period_range, timedelta_range -) -from pandas.compat import isidentifier, lzip, range, string_types + date_range, period_range, timedelta_range) from pandas.core.arrays import PeriodArray from pandas.core.indexes.datetimes import Timestamp +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal, ensure_clean +import pandas.io.formats.printing as printing + from .common import TestData diff --git a/pandas/tests/series/test_apply.py b/pandas/tests/series/test_apply.py index 62a677b82aeb40..f4c8ebe64630cf 100644 --- a/pandas/tests/series/test_apply.py +++ b/pandas/tests/series/test_apply.py @@ -7,11 +7,13 @@ import numpy as np import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import DataFrame, Index, Series, compat, isna +import pandas.compat as compat from pandas.compat import lrange + +import pandas as pd +from pandas import DataFrame, Index, Series, isna from pandas.conftest import _get_cython_table_params +import pandas.util.testing as tm from pandas.util.testing import assert_frame_equal, assert_series_equal diff --git a/pandas/tests/series/test_arithmetic.py b/pandas/tests/series/test_arithmetic.py index e781488a799ec0..979775633f644f 100644 --- a/pandas/tests/series/test_arithmetic.py +++ b/pandas/tests/series/test_arithmetic.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- -import operator from datetime import timedelta +import operator import numpy as np import pytest import pandas as pd -import pandas.util.testing as tm from pandas import Series, compat from pandas.core.indexes.period import IncompatibleFrequency +import pandas.util.testing as tm def _permute(obj): diff --git a/pandas/tests/series/test_asof.py b/pandas/tests/series/test_asof.py index 2d18b617509962..488fc894b953e5 100644 --- a/pandas/tests/series/test_asof.py +++ b/pandas/tests/series/test_asof.py @@ -3,8 +3,8 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import Series, Timestamp, date_range, isna, notna, offsets +import pandas.util.testing as tm class TestSeriesAsof(): diff --git a/pandas/tests/series/test_combine_concat.py b/pandas/tests/series/test_combine_concat.py index 539e3c560b662f..a685eb7e9fbd3f 100644 --- a/pandas/tests/series/test_combine_concat.py +++ b/pandas/tests/series/test_combine_concat.py @@ -4,12 +4,12 @@ from datetime import datetime import numpy as np -import pytest from numpy import nan +import pytest import pandas as pd -import pandas.util.testing as tm from pandas import DataFrame, DatetimeIndex, Series, compat, date_range +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 7595b1278a2916..494321c5190a63 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -5,24 +5,24 @@ from datetime import datetime, timedelta import numpy as np +from numpy import nan import numpy.ma as ma import pytest -from numpy import nan + +from pandas._libs import lib +from pandas._libs.tslib import iNaT +from pandas.compat import PY36, long, lrange, range, zip + +from pandas.core.dtypes.common import ( + is_categorical_dtype, is_datetime64tz_dtype) import pandas as pd -import pandas.util.testing as tm from pandas import ( Categorical, DataFrame, Index, IntervalIndex, MultiIndex, NaT, Series, - Timestamp, date_range, isna, period_range, timedelta_range -) -from pandas._libs import lib -from pandas._libs.tslib import iNaT + Timestamp, date_range, isna, period_range, timedelta_range) from pandas.api.types import CategoricalDtype -from pandas.compat import PY36, long, lrange, range, zip from pandas.core.arrays import period_array -from pandas.core.dtypes.common import ( - is_categorical_dtype, is_datetime64tz_dtype -) +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/test_datetime_values.py b/pandas/tests/series/test_datetime_values.py index 618745eb25a5af..1fd95c4205b0e4 100644 --- a/pandas/tests/series/test_datetime_values.py +++ b/pandas/tests/series/test_datetime_values.py @@ -2,24 +2,25 @@ # pylint: disable-msg=E1101,W0612 import calendar +from datetime import date, datetime, time import locale import unicodedata -from datetime import date, datetime, time import numpy as np import pytest import pytz +from pandas._libs.tslibs.timezones import maybe_get_tz + +from pandas.core.dtypes.common import is_integer_dtype, is_list_like + import pandas as pd -import pandas.core.common as com -import pandas.util.testing as tm from pandas import ( DataFrame, DatetimeIndex, Index, PeriodIndex, Series, TimedeltaIndex, - bdate_range, compat, date_range, period_range, timedelta_range -) -from pandas._libs.tslibs.timezones import maybe_get_tz + bdate_range, compat, date_range, period_range, timedelta_range) from pandas.core.arrays import PeriodArray -from pandas.core.dtypes.common import is_integer_dtype, is_list_like +import pandas.core.common as com +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/test_dtypes.py b/pandas/tests/series/test_dtypes.py index 64184a6465ba3f..a3aaabb70ae8c1 100644 --- a/pandas/tests/series/test_dtypes.py +++ b/pandas/tests/series/test_dtypes.py @@ -1,23 +1,23 @@ # coding=utf-8 # pylint: disable-msg=E1101,W0612 +from datetime import datetime, timedelta import string import sys -from datetime import datetime, timedelta import numpy as np -import pytest from numpy import nan +import pytest -import pandas as pd import pandas._libs.tslib as tslib -import pandas.util.testing as tm +import pandas.compat as compat +from pandas.compat import lrange, range, u + +import pandas as pd from pandas import ( - Categorical, DataFrame, Index, Series, Timedelta, Timestamp, compat, - date_range -) + Categorical, DataFrame, Index, Series, Timedelta, Timestamp, date_range) from pandas.api.types import CategoricalDtype -from pandas.compat import lrange, range, u +import pandas.util.testing as tm class TestSeriesDtypes(object): diff --git a/pandas/tests/series/test_internals.py b/pandas/tests/series/test_internals.py index f6759f039ed98b..8e3b0d19447a1d 100644 --- a/pandas/tests/series/test_internals.py +++ b/pandas/tests/series/test_internals.py @@ -4,14 +4,15 @@ from datetime import datetime import numpy as np -import pytest from numpy import nan +import pytest -import pandas as pd import pandas._libs.lib as lib -import pandas.util.testing as tm + +import pandas as pd from pandas import Series from pandas.core.indexes.datetimes import Timestamp +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/test_io.py b/pandas/tests/series/test_io.py index 033816dd8ee4b8..5749b0c6551d60 100644 --- a/pandas/tests/series/test_io.py +++ b/pandas/tests/series/test_io.py @@ -7,14 +7,15 @@ import numpy as np import pytest +from pandas.compat import StringIO, u + import pandas as pd -import pandas.util.testing as tm from pandas import DataFrame, Series -from pandas.compat import StringIO, u -from pandas.io.common import _get_handle +import pandas.util.testing as tm from pandas.util.testing import ( - assert_almost_equal, assert_frame_equal, assert_series_equal, ensure_clean -) + assert_almost_equal, assert_frame_equal, assert_series_equal, ensure_clean) + +from pandas.io.common import _get_handle class TestSeriesToCSV(): diff --git a/pandas/tests/series/test_missing.py b/pandas/tests/series/test_missing.py index e89bcae052115c..c38b7c0083a218 100644 --- a/pandas/tests/series/test_missing.py +++ b/pandas/tests/series/test_missing.py @@ -5,21 +5,21 @@ from distutils.version import LooseVersion import numpy as np +from numpy import nan import pytest import pytz -from numpy import nan -import pandas as pd +from pandas._libs.tslib import iNaT +from pandas.compat import range +from pandas.errors import PerformanceWarning import pandas.util._test_decorators as td -import pandas.util.testing as tm + +import pandas as pd from pandas import ( Categorical, DataFrame, Index, IntervalIndex, MultiIndex, NaT, Series, - Timestamp, date_range, isna -) -from pandas._libs.tslib import iNaT -from pandas.compat import range + Timestamp, date_range, isna) from pandas.core.series import remove_na -from pandas.errors import PerformanceWarning +import pandas.util.testing as tm from pandas.util.testing import assert_frame_equal, assert_series_equal try: diff --git a/pandas/tests/series/test_operators.py b/pandas/tests/series/test_operators.py index 082ed5e0f5123c..35bd99ff2eda81 100644 --- a/pandas/tests/series/test_operators.py +++ b/pandas/tests/series/test_operators.py @@ -1,25 +1,24 @@ # coding=utf-8 # pylint: disable-msg=E1101,W0612 -import operator from datetime import datetime, timedelta +import operator import numpy as np -import pytest from numpy import nan +import pytest + +import pandas.compat as compat +from pandas.compat import range import pandas as pd -import pandas.core.nanops as nanops -import pandas.util.testing as tm from pandas import ( - Categorical, DataFrame, Index, NaT, Series, bdate_range, compat, - date_range, isna -) -from pandas.compat import range + Categorical, DataFrame, Index, NaT, Series, bdate_range, date_range, isna) from pandas.core import ops +import pandas.core.nanops as nanops +import pandas.util.testing as tm from pandas.util.testing import ( - assert_almost_equal, assert_frame_equal, assert_series_equal -) + assert_almost_equal, assert_frame_equal, assert_series_equal) from .common import TestData diff --git a/pandas/tests/series/test_period.py b/pandas/tests/series/test_period.py index 88a5ff261fbb4e..ce620db8d9c1b1 100644 --- a/pandas/tests/series/test_period.py +++ b/pandas/tests/series/test_period.py @@ -2,9 +2,9 @@ import pytest import pandas as pd -import pandas.util.testing as tm from pandas import DataFrame, Period, Series, period_range from pandas.core.arrays import PeriodArray +import pandas.util.testing as tm class TestSeriesPeriod(object): diff --git a/pandas/tests/series/test_quantile.py b/pandas/tests/series/test_quantile.py index 1a4c72b9f35fc5..027814c618303f 100644 --- a/pandas/tests/series/test_quantile.py +++ b/pandas/tests/series/test_quantile.py @@ -4,11 +4,12 @@ import numpy as np import pytest +from pandas.core.dtypes.common import is_integer + import pandas as pd -import pandas.util.testing as tm from pandas import Index, Series -from pandas.core.dtypes.common import is_integer from pandas.core.indexes.datetimes import Timestamp +import pandas.util.testing as tm from .common import TestData diff --git a/pandas/tests/series/test_rank.py b/pandas/tests/series/test_rank.py index afe1155932ea44..40a30cc8cf09a3 100644 --- a/pandas/tests/series/test_rank.py +++ b/pandas/tests/series/test_rank.py @@ -3,17 +3,19 @@ from itertools import chain import numpy as np -import pytest from numpy import nan +import pytest -import pandas.util._test_decorators as td -import pandas.util.testing as tm -from pandas import NaT, Series, Timestamp, compat, date_range from pandas._libs.algos import Infinity, NegInfinity from pandas._libs.tslib import iNaT -from pandas.api.types import CategoricalDtype +import pandas.compat as compat from pandas.compat import product +import pandas.util._test_decorators as td + +from pandas import NaT, Series, Timestamp, date_range +from pandas.api.types import CategoricalDtype from pandas.tests.series.common import TestData +import pandas.util.testing as tm from pandas.util.testing import assert_series_equal diff --git a/pandas/tests/series/test_replace.py b/pandas/tests/series/test_replace.py index 54318aa9a4a34a..67c75f43e030c1 100644 --- a/pandas/tests/series/test_replace.py +++ b/pandas/tests/series/test_replace.py @@ -4,8 +4,9 @@ import numpy as np import pytest -import pandas as pd import pandas._libs.lib as lib + +import pandas as pd import pandas.util.testing as tm from .common import TestData diff --git a/pandas/tests/series/test_repr.py b/pandas/tests/series/test_repr.py index 8e89dd0f44a4d3..ef962747466559 100644 --- a/pandas/tests/series/test_repr.py +++ b/pandas/tests/series/test_repr.py @@ -1,20 +1,21 @@ # coding=utf-8 # pylint: disable-msg=E1101,W0612 -import sys from datetime import datetime, timedelta +import sys import numpy as np +import pandas.compat as compat +from pandas.compat import lrange, range, u + import pandas as pd -import pandas.util.testing as tm from pandas import ( - Categorical, DataFrame, Index, Series, compat, date_range, option_context, - period_range, timedelta_range -) -from pandas.compat import lrange, range, u + Categorical, DataFrame, Index, Series, date_range, option_context, + period_range, timedelta_range) from pandas.core.base import StringMixin from pandas.core.index import MultiIndex +import pandas.util.testing as tm from .common import TestData diff --git a/pandas/tests/series/test_sorting.py b/pandas/tests/series/test_sorting.py index f15160d9ebab6e..ef6998c1a3e12d 100644 --- a/pandas/tests/series/test_sorting.py +++ b/pandas/tests/series/test_sorting.py @@ -5,8 +5,8 @@ import numpy as np import pytest -import pandas.util.testing as tm from pandas import Categorical, DataFrame, IntervalIndex, MultiIndex, Series +import pandas.util.testing as tm from pandas.util.testing import assert_almost_equal, assert_series_equal from .common import TestData diff --git a/pandas/tests/series/test_subclass.py b/pandas/tests/series/test_subclass.py index f48b4e6a7510f5..68a162ee4c287e 100644 --- a/pandas/tests/series/test_subclass.py +++ b/pandas/tests/series/test_subclass.py @@ -3,8 +3,8 @@ import numpy as np import pandas as pd -import pandas.util.testing as tm from pandas import SparseDtype +import pandas.util.testing as tm class TestSeriesSubclassing(object): diff --git a/pandas/tests/series/test_timeseries.py b/pandas/tests/series/test_timeseries.py index b46570fcfb1a5b..21f80f181c34df 100644 --- a/pandas/tests/series/test_timeseries.py +++ b/pandas/tests/series/test_timeseries.py @@ -6,23 +6,23 @@ import numpy as np import pytest -import pandas as pd +from pandas._libs.tslib import iNaT +from pandas.compat import StringIO, lrange, product +from pandas.errors import NullFrequencyError import pandas.util._test_decorators as td -import pandas.util.testing as tm + +import pandas as pd from pandas import ( DataFrame, Index, NaT, Series, Timestamp, concat, date_range, offsets, - timedelta_range, to_datetime -) -from pandas._libs.tslib import iNaT -from pandas.compat import StringIO, lrange, product + timedelta_range, to_datetime) from pandas.core.indexes.datetimes import DatetimeIndex from pandas.core.indexes.timedeltas import TimedeltaIndex -from pandas.errors import NullFrequencyError from pandas.tests.series.common import TestData -from pandas.tseries.offsets import BDay, BMonthEnd +import pandas.util.testing as tm from pandas.util.testing import ( - assert_almost_equal, assert_frame_equal, assert_series_equal -) + assert_almost_equal, assert_frame_equal, assert_series_equal) + +from pandas.tseries.offsets import BDay, BMonthEnd def _simple_ts(start, end, freq='D'): diff --git a/pandas/tests/series/test_timezones.py b/pandas/tests/series/test_timezones.py index 0b65af6831d070..3c9701758f12cf 100644 --- a/pandas/tests/series/test_timezones.py +++ b/pandas/tests/series/test_timezones.py @@ -4,16 +4,17 @@ """ from datetime import datetime +from dateutil.tz import tzoffset import numpy as np import pytest import pytz -from dateutil.tz import tzoffset -import pandas.util.testing as tm -from pandas import DatetimeIndex, Index, NaT, Series, Timestamp from pandas._libs.tslibs import conversion, timezones from pandas.compat import lrange + +from pandas import DatetimeIndex, Index, NaT, Series, Timestamp from pandas.core.indexes.datetimes import date_range +import pandas.util.testing as tm class TestSeriesTimezones(object): diff --git a/pandas/tests/tslibs/test_liboffsets.py b/pandas/tests/tslibs/test_liboffsets.py index 50d8f546d8e58f..388df6453634e0 100644 --- a/pandas/tests/tslibs/test_liboffsets.py +++ b/pandas/tests/tslibs/test_liboffsets.py @@ -7,9 +7,10 @@ import pytest import pandas._libs.tslibs.offsets as liboffsets -from pandas import Timestamp from pandas._libs.tslibs.offsets import roll_qtrday +from pandas import Timestamp + def test_get_lastbday(): dt = datetime(2017, 11, 30) diff --git a/pandas/tests/tslibs/test_timedeltas.py b/pandas/tests/tslibs/test_timedeltas.py index 939c2b828a75f5..50e64bb7c20822 100644 --- a/pandas/tests/tslibs/test_timedeltas.py +++ b/pandas/tests/tslibs/test_timedeltas.py @@ -2,9 +2,10 @@ import numpy as np import pytest -import pandas as pd from pandas._libs.tslibs.timedeltas import delta_to_nanoseconds +import pandas as pd + def test_delta_to_nanoseconds(): obj = np.timedelta64(14, 'D') diff --git a/pandas/tseries/api.py b/pandas/tseries/api.py index 982a0e715e3607..2094791ecdc609 100644 --- a/pandas/tseries/api.py +++ b/pandas/tseries/api.py @@ -4,5 +4,5 @@ # flake8: noqa -import pandas.tseries.offsets as offsets from pandas.tseries.frequencies import infer_freq +import pandas.tseries.offsets as offsets diff --git a/setup.cfg b/setup.cfg index e1d0dc84f464a7..1cfefa1bbaadd2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -77,11 +77,17 @@ exclude_lines = directory = coverage_html_report [isort] +known_pre_core=pandas._libs,pandas.util._*,pandas.compat,pandas.errors +known_dtypes=pandas.core.dtypes +known_post_core=pandas.tseries,pandas.io,pandas.plotting +sections=FUTURE,STDLIB,THIRDPARTY,PRE_CORE,DTYPES,FIRSTPARTY,POST_CORE,LOCALFOLDER + known_first_party=pandas -known_third_party=Cython,numpy,python-dateutil,pytz -multi_line_output=5 +known_third_party=Cython,numpy,python-dateutil,pytz,pyarrow +multi_line_output=4 force_grid_wrap=0 combine_as_imports=True +force_sort_within_sections=True skip= pandas/lib.py, pandas/tslib.py,