@@ -860,6 +860,23 @@ def size(self):
860
860
from pandas import Series
861
861
862
862
result = Series ([], index = result .index , dtype = "int64" )
863
+ elif not len (self .ax ) and isinstance (self ._selected_obj , ABCSeries ):
864
+ from pandas import Series
865
+
866
+ result = Series ([], index = result .index , dtype = "int64" ,
867
+ name = self ._selected_obj .name )
868
+
869
+ return result
870
+
871
+ @Appender (GroupBy .size .__doc__ )
872
+ def count (self ):
873
+ result = self ._downsample ("count" )
874
+ if not len (self .ax ) and isinstance (self ._selected_obj , ABCSeries ):
875
+ from pandas import Series
876
+
877
+ result = Series ([], index = result .index , dtype = "int64" ,
878
+ name = self ._selected_obj .name )
879
+
863
880
return result
864
881
865
882
def quantile (self , q = 0.5 , ** kwargs ):
@@ -907,14 +924,6 @@ def g(self, _method=method, *args, **kwargs):
907
924
g .__doc__ = getattr (GroupBy , method ).__doc__
908
925
setattr (Resampler , method , g )
909
926
910
- # groupby & aggregate methods
911
- for method in ["count" ]:
912
-
913
- def h (self , _method = method ):
914
- return self ._downsample (_method )
915
-
916
- h .__doc__ = getattr (GroupBy , method ).__doc__
917
- setattr (Resampler , method , h )
918
927
919
928
# series only methods
920
929
for method in ["nunique" ]:
0 commit comments