File tree 4 files changed +17
-11
lines changed
4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 102
102
from pandas .core .arrays .datetimelike import DatetimeLikeArrayMixin as DatetimeLikeArray
103
103
from pandas .core .arrays .sparse import SparseFrameAccessor
104
104
from pandas .core .generic import NDFrame , _shared_docs
105
- from pandas .core .groupby import generic as groupby_generic
106
105
from pandas .core .indexes import base as ibase
107
106
from pandas .core .indexes .api import Index , ensure_index , ensure_index_from_sequences
108
107
from pandas .core .indexes .datetimes import DatetimeIndex
129
128
import pandas .plotting
130
129
131
130
if TYPE_CHECKING :
131
+ from pandas .core .groupby .generic import DataFrameGroupBy
132
132
from pandas .io .formats .style import Styler
133
133
134
134
# ---------------------------------------------------------------------
@@ -5777,13 +5777,14 @@ def groupby(
5777
5777
group_keys : bool = True ,
5778
5778
squeeze : bool = False ,
5779
5779
observed : bool = False ,
5780
- ) -> "groupby_generic.DataFrameGroupBy" :
5780
+ ) -> "DataFrameGroupBy" :
5781
+ from pandas .core .groupby .generic import DataFrameGroupBy
5781
5782
5782
5783
if level is None and by is None :
5783
5784
raise TypeError ("You have to supply one of 'by' and 'level'" )
5784
5785
axis = self ._get_axis_number (axis )
5785
5786
5786
- return groupby_generic . DataFrameGroupBy (
5787
+ return DataFrameGroupBy (
5787
5788
obj = self ,
5788
5789
keys = by ,
5789
5790
axis = axis ,
Original file line number Diff line number Diff line change 8
8
import re
9
9
from textwrap import dedent
10
10
from typing import (
11
+ TYPE_CHECKING ,
11
12
Any ,
12
13
Callable ,
13
14
Dict ,
101
102
from pandas .io .formats .printing import pprint_thing
102
103
from pandas .tseries .frequencies import to_offset
103
104
105
+ if TYPE_CHECKING :
106
+ from pandas .core .resample import Resampler
107
+
104
108
# goal is to be able to define the docs close to function, while still being
105
109
# able to share
106
110
_shared_docs : Dict [str , str ] = dict ()
@@ -7685,7 +7689,7 @@ def resample(
7685
7689
base : int = 0 ,
7686
7690
on = None ,
7687
7691
level = None ,
7688
- ):
7692
+ ) -> "Resampler" :
7689
7693
"""
7690
7694
Resample time-series data.
7691
7695
@@ -7950,10 +7954,10 @@ def resample(
7950
7954
2000-01-04 36 90
7951
7955
"""
7952
7956
7953
- from pandas .core .resample import resample
7957
+ from pandas .core .resample import get_resampler
7954
7958
7955
7959
axis = self ._get_axis_number (axis )
7956
- return resample (
7960
+ return get_resampler (
7957
7961
self ,
7958
7962
freq = rule ,
7959
7963
label = label ,
Original file line number Diff line number Diff line change @@ -1262,15 +1262,15 @@ def _constructor(self):
1262
1262
return TimedeltaIndexResampler
1263
1263
1264
1264
1265
- def resample (obj , kind = None , ** kwds ):
1265
+ def get_resampler (obj , kind = None , ** kwds ):
1266
1266
"""
1267
1267
Create a TimeGrouper and return our resampler.
1268
1268
"""
1269
1269
tg = TimeGrouper (** kwds )
1270
1270
return tg ._get_resampler (obj , kind = kind )
1271
1271
1272
1272
1273
- resample .__doc__ = Resampler .__doc__
1273
+ get_resampler .__doc__ = Resampler .__doc__
1274
1274
1275
1275
1276
1276
def get_resampler_for_grouping (
Original file line number Diff line number Diff line change 70
70
is_empty_data ,
71
71
sanitize_array ,
72
72
)
73
- from pandas .core .groupby import generic as groupby_generic
74
73
from pandas .core .indexers import maybe_convert_indices
75
74
from pandas .core .indexes .accessors import CombinedDatetimelikeProperties
76
75
from pandas .core .indexes .api import (
94
93
95
94
if TYPE_CHECKING :
96
95
from pandas .core .frame import DataFrame
96
+ from pandas .core .groupby .generic import SeriesGroupBy
97
97
98
98
__all__ = ["Series" ]
99
99
@@ -1634,13 +1634,14 @@ def groupby(
1634
1634
group_keys : bool = True ,
1635
1635
squeeze : bool = False ,
1636
1636
observed : bool = False ,
1637
- ) -> "groupby_generic.SeriesGroupBy" :
1637
+ ) -> "SeriesGroupBy" :
1638
+ from pandas .core .groupby .generic import SeriesGroupBy
1638
1639
1639
1640
if level is None and by is None :
1640
1641
raise TypeError ("You have to supply one of 'by' and 'level'" )
1641
1642
axis = self ._get_axis_number (axis )
1642
1643
1643
- return groupby_generic . SeriesGroupBy (
1644
+ return SeriesGroupBy (
1644
1645
obj = self ,
1645
1646
keys = by ,
1646
1647
axis = axis ,
You can’t perform that action at this time.
0 commit comments