@@ -64,7 +64,7 @@ class Resampler(_GroupBy):
64
64
'binner' , 'grouper' , 'groupby' ,
65
65
'sort' , 'kind' , 'squeeze' , 'keys' ,
66
66
'group_keys' , 'as_index' , 'exclusions' ,
67
- '_groupby' , 'from_selection ' ]
67
+ '_groupby' , '_from_selection ' ]
68
68
69
69
# don't raise deprecation warning on attributes starting with these
70
70
# patterns - prevents warnings caused by IPython introspection
@@ -85,14 +85,14 @@ def __init__(self, obj, groupby=None, axis=0, kind=None, **kwargs):
85
85
self .exclusions = set ()
86
86
self .binner = None
87
87
self .grouper = None
88
- self .from_selection = False
88
+ self ._from_selection = False
89
89
90
90
if self .groupby is not None :
91
91
# upsampling and PeriodIndex resampling do not work
92
92
# if resampling on a column or mi level
93
93
# this state used to catch and raise an error
94
- self .from_selection = (self .groupby .key is not None or
95
- self .groupby .level is not None )
94
+ self ._from_selection = (self .groupby .key is not None or
95
+ self .groupby .level is not None )
96
96
self .groupby ._set_grouper (self ._convert_obj (obj ), sort = True )
97
97
98
98
def __unicode__ (self ):
@@ -716,11 +716,11 @@ def _upsample(self, method, limit=None):
716
716
self ._set_binner ()
717
717
if self .axis :
718
718
raise AssertionError ('axis must be 0' )
719
- if self .from_selection :
720
- raise NotImplementedError ("Upsampling from level= or on= selection"
721
- " is not supported, use .set_index(...)"
722
- " to explicitly set index to"
723
- " datetime-like" )
719
+ if self ._from_selection :
720
+ raise ValueError ("Upsampling from level= or on= selection"
721
+ " is not supported, use .set_index(...)"
722
+ " to explicitly set index to"
723
+ " datetime-like" )
724
724
725
725
ax = self .ax
726
726
obj = self ._selected_obj
@@ -778,7 +778,7 @@ def _convert_obj(self, obj):
778
778
779
779
# convert to timestamp
780
780
if not (self .kind is None or self .kind == 'period' ):
781
- if self .from_selection :
781
+ if self ._from_selection :
782
782
# see GH 14008, GH 12871
783
783
msg = ("Resampling from level= or on= selection"
784
784
" with a PeriodIndex is not currently supported,"
@@ -863,11 +863,11 @@ def _upsample(self, method, limit=None):
863
863
.fillna
864
864
865
865
"""
866
- if self .from_selection :
867
- raise NotImplementedError ("Upsampling from level= or on= selection"
868
- " is not supported, use .set_index(...)"
869
- " to explicitly set index to"
870
- " datetime-like" )
866
+ if self ._from_selection :
867
+ raise ValueError ("Upsampling from level= or on= selection"
868
+ " is not supported, use .set_index(...)"
869
+ " to explicitly set index to"
870
+ " datetime-like" )
871
871
# we may need to actually resample as if we are timestamps
872
872
if self .kind == 'timestamp' :
873
873
return super (PeriodIndexResampler , self )._upsample (method ,
0 commit comments