@@ -9381,7 +9381,7 @@ def compound(self, axis=None, skipna=None, level=None):
9381
9381
"""This method returns the maximum of the values in the object.
9382
9382
If you want the *index* of the maximum, use ``idxmax``. This is
9383
9383
the equivalent of the ``numpy.ndarray`` method ``argmax``.""" ,
9384
- nanops .nanmax )
9384
+ nanops .nanmax , _max_examples )
9385
9385
cls .min = _make_stat_function (
9386
9386
cls , 'min' , name , name2 , axis_descr ,
9387
9387
"""This method returns the minimum of the values in the object.
@@ -10229,6 +10229,44 @@ def _doc_parms(cls):
10229
10229
nan
10230
10230
"""
10231
10231
10232
+ _max_examples = """\
10233
+ Examples
10234
+ --------
10235
+ ``MultiIndex`` series example of monthly rainfall
10236
+
10237
+ >>> index = pd.MultiIndex.from_product(
10238
+ ... [['London', 'New York'], ['Jun', 'Jul', 'Aug']],
10239
+ ... names=['city', 'month'])
10240
+ >>> s = pd.Series([47, 35, 54, 112, 117, 113], index=index)
10241
+ >>> s
10242
+ city month
10243
+ London Jun 47
10244
+ Jul 35
10245
+ Aug 54
10246
+ New York Jun 112
10247
+ Jul 117
10248
+ Aug 113
10249
+ dtype: int64
10250
+
10251
+ >>> s.max()
10252
+ 117
10253
+
10254
+ Max using level names, as well as indices
10255
+
10256
+ >>> s.max(level='city')
10257
+ city
10258
+ London 54
10259
+ New York 117
10260
+ dtype: int64
10261
+
10262
+ >>> s.max(level=1)
10263
+ month
10264
+ Jun 112
10265
+ Jul 117
10266
+ Aug 113
10267
+ dtype: int64
10268
+ """
10269
+
10232
10270
10233
10271
_min_count_stub = """\
10234
10272
min_count : int, default 0
@@ -10266,9 +10304,10 @@ def stat_func(self, axis=None, skipna=None, level=None, numeric_only=None,
10266
10304
return set_function_name (stat_func , name , cls )
10267
10305
10268
10306
10269
- def _make_stat_function (cls , name , name1 , name2 , axis_descr , desc , f ):
10307
+ def _make_stat_function (cls , name , name1 , name2 , axis_descr , desc , f ,
10308
+ examples = '' ):
10270
10309
@Substitution (outname = name , desc = desc , name1 = name1 , name2 = name2 ,
10271
- axis_descr = axis_descr , min_count = '' , examples = '' )
10310
+ axis_descr = axis_descr , min_count = '' , examples = examples )
10272
10311
@Appender (_num_doc )
10273
10312
def stat_func (self , axis = None , skipna = None , level = None , numeric_only = None ,
10274
10313
** kwargs ):
0 commit comments