Skip to content

Commit

Permalink
style: fix import format at pandas/core/reshape (#23387)
Browse files Browse the repository at this point in the history
  • Loading branch information
streeck authored and jreback committed Nov 1, 2018
1 parent d4aaf61 commit 9019582
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 116 deletions.
6 changes: 3 additions & 3 deletions pandas/core/reshape/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# flake8: noqa

from pandas.core.reshape.concat import concat
from pandas.core.reshape.melt import melt, lreshape, wide_to_long
from pandas.core.reshape.melt import lreshape, melt, wide_to_long
from pandas.core.reshape.merge import merge, merge_asof, merge_ordered
from pandas.core.reshape.pivot import crosstab, pivot, pivot_table
from pandas.core.reshape.reshape import get_dummies
from pandas.core.reshape.merge import merge, merge_ordered, merge_asof
from pandas.core.reshape.pivot import pivot_table, pivot, crosstab
from pandas.core.reshape.tile import cut, qcut
20 changes: 11 additions & 9 deletions pandas/core/reshape/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
"""

import numpy as np
from pandas import compat, DataFrame, Series, Index, MultiIndex
from pandas.core.index import (_get_objs_combined_axis,
ensure_index, _get_consensus_names,
_all_indexes_same)
from pandas.core.arrays.categorical import (_factorize_from_iterable,
_factorize_from_iterables)
from pandas.core.internals import concatenate_block_managers

import pandas.core.dtypes.concat as _concat

from pandas import DataFrame, Index, MultiIndex, Series, compat
from pandas.core import common as com
import pandas.core.indexes.base as ibase
from pandas.core.arrays.categorical import (
_factorize_from_iterable, _factorize_from_iterables)
from pandas.core.generic import NDFrame
import pandas.core.dtypes.concat as _concat
from pandas.core.index import (
_all_indexes_same, _get_consensus_names, _get_objs_combined_axis,
ensure_index)
import pandas.core.indexes.base as ibase
from pandas.core.internals import concatenate_block_managers

# ---------------------------------------------------------------------
# Concatenate DataFrame objects
Expand Down
17 changes: 8 additions & 9 deletions pandas/core/reshape/melt.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# pylint: disable=E1101,E1103
# pylint: disable=W0703,W0622,W0613,W0201
import re

import numpy as np

from pandas.core.dtypes.common import is_list_like
from pandas import compat
from pandas.core.arrays import Categorical
from pandas.util._decorators import Appender

from pandas.core.dtypes.common import is_extension_type, is_list_like
from pandas.core.dtypes.generic import ABCMultiIndex
from pandas.core.dtypes.missing import notna

from pandas import compat
from pandas.core.arrays import Categorical
from pandas.core.frame import _shared_docs
from pandas.util._decorators import Appender

import re
from pandas.core.dtypes.missing import notna
from pandas.core.dtypes.common import is_extension_type
from pandas.core.tools.numeric import to_numeric
from pandas.core.reshape.concat import concat
from pandas.core.tools.numeric import to_numeric


@Appender(_shared_docs['melt'] %
Expand Down
55 changes: 20 additions & 35 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,34 @@
"""

import copy
import warnings
import string
import warnings

import numpy as np
from pandas.compat import range, lzip, zip, map, filter
import pandas.compat as compat

from pandas import (Categorical, DataFrame,
Index, MultiIndex, Timedelta, Series)
from pandas.core.arrays.categorical import _recode_for_categories
from pandas.core.frame import _merge_doc
from pandas.core.dtypes.common import (
is_datetime64tz_dtype,
is_datetime64_dtype,
needs_i8_conversion,
is_int64_dtype,
is_array_like,
is_categorical_dtype,
is_integer_dtype,
is_float_dtype,
is_number,
is_numeric_dtype,
is_integer,
is_int_or_datetime_dtype,
is_dtype_equal,
is_bool,
is_bool_dtype,
is_list_like,
is_datetimelike,
ensure_int64,
ensure_float64,
ensure_object)
from pandas.core.dtypes.missing import na_value_for_dtype, isnull
from pandas.core.internals import (items_overlap_with_suffix,
concatenate_block_managers)
from pandas._libs import hashtable as libhashtable, join as libjoin, lib
import pandas.compat as compat
from pandas.compat import filter, lzip, map, range, zip
from pandas.errors import MergeError
from pandas.util._decorators import Appender, Substitution

from pandas.core.sorting import is_int64_overflow_possible
from pandas.core.dtypes.common import (
ensure_float64, ensure_int64, ensure_object, is_array_like, is_bool,
is_bool_dtype, is_categorical_dtype, is_datetime64_dtype,
is_datetime64tz_dtype, is_datetimelike, is_dtype_equal, is_float_dtype,
is_int64_dtype, is_int_or_datetime_dtype, is_integer, is_integer_dtype,
is_list_like, is_number, is_numeric_dtype, needs_i8_conversion)
from pandas.core.dtypes.missing import isnull, na_value_for_dtype

from pandas import Categorical, DataFrame, Index, MultiIndex, Series, Timedelta
import pandas.core.algorithms as algos
import pandas.core.sorting as sorting
from pandas.core.arrays.categorical import _recode_for_categories
import pandas.core.common as com
from pandas._libs import hashtable as libhashtable, join as libjoin, lib
from pandas.errors import MergeError
from pandas.core.frame import _merge_doc
from pandas.core.internals import (
concatenate_block_managers, items_overlap_with_suffix)
import pandas.core.sorting as sorting
from pandas.core.sorting import is_int64_overflow_possible


@Substitution('\nleft : DataFrame')
Expand Down
27 changes: 12 additions & 15 deletions pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# pylint: disable=E1103
import numpy as np

from pandas.compat import lrange, range, zip
from pandas.util._decorators import Appender, Substitution

from pandas.core.dtypes.common import (
is_list_like, is_scalar, is_integer_dtype)
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries
from pandas.core.dtypes.cast import maybe_downcast_to_dtype
from pandas.core.dtypes.common import is_integer_dtype, is_list_like, is_scalar
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries

from pandas.core.reshape.concat import concat
from pandas.core.series import Series
from pandas.core.groupby import Grouper
from pandas.core.reshape.util import cartesian_product
from pandas.core.index import Index, MultiIndex, _get_objs_combined_axis
from pandas.compat import range, lrange, zip
from pandas import compat
import pandas.core.common as com
from pandas.util._decorators import Appender, Substitution

from pandas.core.frame import _shared_docs
# Note: We need to make sure `frame` is imported before `pivot`, otherwise
# _shared_docs['pivot_table'] will not yet exist. TODO: Fix this dependency

import numpy as np
from pandas.core.groupby import Grouper
from pandas.core.index import Index, MultiIndex, _get_objs_combined_axis
from pandas.core.reshape.concat import concat
from pandas.core.reshape.util import cartesian_product
from pandas.core.series import Series


# Note: We need to make sure `frame` is imported before `pivot`, otherwise
# _shared_docs['pivot_table'] will not yet exist. TODO: Fix this dependency
@Substitution('\ndata : DataFrame')
@Appender(_shared_docs['pivot_table'], indents=1)
def pivot_table(data, values=None, index=None, columns=None, aggfunc='mean',
Expand Down
37 changes: 16 additions & 21 deletions pandas/core/reshape/reshape.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
# pylint: disable=E1101,E1103
# pylint: disable=W0703,W0622,W0613,W0201
from pandas.compat import range, text_type, zip, u, PY2
from pandas import compat
from functools import partial
import itertools

import numpy as np

from pandas.core.dtypes.common import (
ensure_platform_int,
is_list_like, is_bool_dtype,
is_extension_array_dtype,
needs_i8_conversion, is_sparse, is_object_dtype)
from pandas.core.dtypes.cast import maybe_promote
from pandas.core.dtypes.missing import notna

from pandas.core.series import Series
from pandas.core.frame import DataFrame

from pandas.core.sparse.api import SparseDataFrame, SparseSeries
from pandas.core.arrays import SparseArray
from pandas._libs import algos as _algos, reshape as _reshape
from pandas._libs.sparse import IntIndex
from pandas.compat import PY2, range, text_type, u, zip

from pandas.core.arrays import Categorical
from pandas.core.arrays.categorical import _factorize_from_iterable
from pandas.core.sorting import (get_group_index, get_compressed_ids,
compress_group_index, decons_obs_group_ids)
from pandas.core.dtypes.cast import maybe_promote
from pandas.core.dtypes.common import (
ensure_platform_int, is_bool_dtype, is_extension_array_dtype, is_list_like,
is_object_dtype, is_sparse, needs_i8_conversion)
from pandas.core.dtypes.missing import notna

from pandas import compat
import pandas.core.algorithms as algos
from pandas._libs import algos as _algos, reshape as _reshape

from pandas.core.arrays import Categorical, SparseArray
from pandas.core.arrays.categorical import _factorize_from_iterable
from pandas.core.frame import DataFrame
from pandas.core.index import Index, MultiIndex
from pandas.core.series import Series
from pandas.core.sorting import (
compress_group_index, decons_obs_group_ids, get_compressed_ids,
get_group_index)
from pandas.core.sparse.api import SparseDataFrame, SparseSeries


class _Unstacker(object):
Expand Down
26 changes: 11 additions & 15 deletions pandas/core/reshape/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,21 @@
"""
from functools import partial

from pandas.core.dtypes.missing import isna
import numpy as np

from pandas._libs.lib import infer_dtype

from pandas.core.dtypes.common import (
is_integer,
is_scalar,
is_categorical_dtype,
is_datetime64_dtype,
is_timedelta64_dtype,
is_datetime64tz_dtype,
is_datetime_or_timedelta_dtype,
ensure_int64)
ensure_int64, is_categorical_dtype, is_datetime64_dtype,
is_datetime64tz_dtype, is_datetime_or_timedelta_dtype, is_integer,
is_scalar, is_timedelta64_dtype)
from pandas.core.dtypes.missing import isna

from pandas import (
Categorical, Index, Interval, IntervalIndex, Series, Timedelta, Timestamp,
to_datetime, to_timedelta)
import pandas.core.algorithms as algos
import pandas.core.nanops as nanops
from pandas._libs.lib import infer_dtype
from pandas import (to_timedelta, to_datetime,
Categorical, Timestamp, Timedelta,
Series, Index, Interval, IntervalIndex)

import numpy as np


def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/reshape/util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import numpy as np

from pandas.compat import reduce

from pandas.core.dtypes.common import is_list_like

from pandas.compat import reduce
from pandas.core import common as com


Expand Down
8 changes: 0 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,6 @@ skip=
pandas/core/internals/concat.py,
pandas/core/internals/managers.py,
pandas/core/internals/blocks.py,
pandas/core/reshape/concat.py,
pandas/core/reshape/tile.py,
pandas/core/reshape/melt.py,
pandas/core/reshape/api.py,
pandas/core/reshape/util.py,
pandas/core/reshape/merge.py,
pandas/core/reshape/reshape.py,
pandas/core/reshape/pivot.py,
pandas/core/sparse/api.py,
pandas/core/sparse/series.py,
pandas/core/sparse/frame.py,
Expand Down

0 comments on commit 9019582

Please sign in to comment.