File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 102102from pandas .core .arrays .datetimelike import DatetimeLikeArrayMixin as DatetimeLikeArray
103103from pandas .core .arrays .sparse import SparseFrameAccessor
104104from pandas .core .generic import NDFrame , _shared_docs
105- from pandas .core .groupby import generic as groupby_generic
106105from pandas .core .indexes import base as ibase
107106from pandas .core .indexes .api import Index , ensure_index , ensure_index_from_sequences
108107from pandas .core .indexes .datetimes import DatetimeIndex
129128import pandas .plotting
130129
131130if TYPE_CHECKING :
131+ from pandas .core .groupby .generic import DataFrameGroupBy
132132 from pandas .io .formats .style import Styler
133133
134134# ---------------------------------------------------------------------
@@ -5777,13 +5777,14 @@ def groupby(
57775777 group_keys : bool = True ,
57785778 squeeze : bool = False ,
57795779 observed : bool = False ,
5780- ) -> "groupby_generic.DataFrameGroupBy" :
5780+ ) -> "DataFrameGroupBy" :
5781+ from pandas .core .groupby .generic import DataFrameGroupBy
57815782
57825783 if level is None and by is None :
57835784 raise TypeError ("You have to supply one of 'by' and 'level'" )
57845785 axis = self ._get_axis_number (axis )
57855786
5786- return groupby_generic . DataFrameGroupBy (
5787+ return DataFrameGroupBy (
57875788 obj = self ,
57885789 keys = by ,
57895790 axis = axis ,
Original file line number Diff line number Diff line change 88import re
99from textwrap import dedent
1010from typing import (
11+ TYPE_CHECKING ,
1112 Any ,
1213 Callable ,
1314 Dict ,
101102from pandas .io .formats .printing import pprint_thing
102103from pandas .tseries .frequencies import to_offset
103104
105+ if TYPE_CHECKING :
106+ from pandas .core .resample import Resampler
107+
104108# goal is to be able to define the docs close to function, while still being
105109# able to share
106110_shared_docs : Dict [str , str ] = dict ()
@@ -7685,7 +7689,7 @@ def resample(
76857689 base : int = 0 ,
76867690 on = None ,
76877691 level = None ,
7688- ):
7692+ ) -> "Resampler" :
76897693 """
76907694 Resample time-series data.
76917695
@@ -7950,10 +7954,10 @@ def resample(
79507954 2000-01-04 36 90
79517955 """
79527956
7953- from pandas .core .resample import resample
7957+ from pandas .core .resample import get_resampler
79547958
79557959 axis = self ._get_axis_number (axis )
7956- return resample (
7960+ return get_resampler (
79577961 self ,
79587962 freq = rule ,
79597963 label = label ,
Original file line number Diff line number Diff line change @@ -1262,15 +1262,15 @@ def _constructor(self):
12621262 return TimedeltaIndexResampler
12631263
12641264
1265- def resample (obj , kind = None , ** kwds ):
1265+ def get_resampler (obj , kind = None , ** kwds ):
12661266 """
12671267 Create a TimeGrouper and return our resampler.
12681268 """
12691269 tg = TimeGrouper (** kwds )
12701270 return tg ._get_resampler (obj , kind = kind )
12711271
12721272
1273- resample .__doc__ = Resampler .__doc__
1273+ get_resampler .__doc__ = Resampler .__doc__
12741274
12751275
12761276def get_resampler_for_grouping (
Original file line number Diff line number Diff line change 7070 is_empty_data ,
7171 sanitize_array ,
7272)
73- from pandas .core .groupby import generic as groupby_generic
7473from pandas .core .indexers import maybe_convert_indices
7574from pandas .core .indexes .accessors import CombinedDatetimelikeProperties
7675from pandas .core .indexes .api import (
9493
9594if TYPE_CHECKING :
9695 from pandas .core .frame import DataFrame
96+ from pandas .core .groupby .generic import SeriesGroupBy
9797
9898__all__ = ["Series" ]
9999
@@ -1634,13 +1634,14 @@ def groupby(
16341634 group_keys : bool = True ,
16351635 squeeze : bool = False ,
16361636 observed : bool = False ,
1637- ) -> "groupby_generic.SeriesGroupBy" :
1637+ ) -> "SeriesGroupBy" :
1638+ from pandas .core .groupby .generic import SeriesGroupBy
16381639
16391640 if level is None and by is None :
16401641 raise TypeError ("You have to supply one of 'by' and 'level'" )
16411642 axis = self ._get_axis_number (axis )
16421643
1643- return groupby_generic . SeriesGroupBy (
1644+ return SeriesGroupBy (
16441645 obj = self ,
16451646 keys = by ,
16461647 axis = axis ,
You can’t perform that action at this time.
0 commit comments