Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 8fc958a

Browse files
authored
Correct doc for df max (#686)
1 parent f44004b commit 8fc958a

2 files changed

Lines changed: 92 additions & 20 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# *****************************************************************************
2+
# Copyright (c) 2020, Intel Corporation All rights reserved.
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions are met:
6+
#
7+
# Redistributions of source code must retain the above copyright notice,
8+
# this list of conditions and the following disclaimer.
9+
#
10+
# Redistributions in binary form must reproduce the above copyright notice,
11+
# this list of conditions and the following disclaimer in the documentation
12+
# and/or other materials provided with the distribution.
13+
#
14+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
18+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23+
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
# *****************************************************************************
26+
27+
"""
28+
Expected result:
29+
A 0.6
30+
B 6.0
31+
C inf
32+
dtype: float64
33+
"""
34+
35+
import pandas as pd
36+
import numpy as np
37+
from numba import njit
38+
39+
40+
@njit
41+
def dataframe_max():
42+
df = pd.DataFrame({"A": [.2, .0, .6, .2],
43+
"B": [2, 0, 6, 2],
44+
"C": [-1, np.nan, 1, np.inf]})
45+
46+
return df.max()
47+
48+
49+
print(dataframe_max())

sdc/datatypes/hpat_pandas_dataframe_functions.py

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -871,30 +871,53 @@ def var_overload(df, axis=None, skipna=None, level=None, ddof=1, numeric_only=No
871871
@sdc_overload_method(DataFrameType, 'max')
872872
def max_overload(df, axis=None, skipna=None, level=None, numeric_only=None):
873873
"""
874-
Pandas DataFrame method :meth:`pandas.DataFrame.max` implementation.
874+
Intel Scalable Dataframe Compiler User Guide
875+
********************************************
875876
876-
.. only:: developer
877+
Pandas API: pandas.DataFrame.max
877878
878-
Test: python -m sdc.runtests -k sdc.tests.test_dataframe.TestDataFrame.test_max*
879+
Limitations
880+
-----------
881+
Parameters ``axis``, ``level`` and ``numeric_only`` are unsupported.
879882
880-
Parameters
881-
-----------
882-
df: :class:`pandas.DataFrame`
883-
input arg
884-
axis:
885-
*unsupported*
886-
skipna:
887-
*unsupported*
888-
level:
889-
*unsupported*
890-
numeric_only:
891-
*unsupported*
883+
Examples
884+
--------
885+
.. literalinclude:: ../../../examples/dataframe/dataframe_max.py
886+
:language: python
887+
:lines: 35-
888+
:caption: Return the maximum of the values for the columns.
889+
:name: ex_dataframe_max
892890
893-
Returns
894-
-------
895-
:obj:`pandas.Series` or `pandas.DataFrame`
896-
return the maximum of the values for the requested axis.
897-
"""
891+
.. command-output:: python ./dataframe/dataframe_max.py
892+
:cwd: ../../../examples
893+
894+
.. seealso::
895+
:ref:`Series.sum <pandas.Series.sum>`
896+
Return the sum.
897+
:ref:`Series.max <pandas.Series.max>`
898+
Return the maximum.
899+
:ref:`Series.idxmin <pandas.Series.idxmin>`
900+
Return the index of the minimum.
901+
:ref:`Series.idxmax <pandas.Series.idxmax>`
902+
Return the index of the maximum.
903+
:ref:`DataFrame.sum <pandas.DataFrame.sum>`
904+
Return the sum over the requested axis.
905+
:ref:`DataFrame.min <pandas.DataFrame.min>`
906+
Return the minimum over the requested axis.
907+
:ref:`DataFrame.idxmin <pandas.DataFrame.idxmin>`
908+
Return the index of the minimum over the requested axis.
909+
:ref:`DataFrame.idxmax <pandas.DataFrame.idxmax>`
910+
Return the index of the maximum over the requested axis.
911+
912+
Intel Scalable Dataframe Compiler Developer Guide
913+
*************************************************
914+
915+
Pandas DataFrame method :meth:`pandas.DataFrame.max` implementation.
916+
917+
.. only:: developer
918+
919+
Test: python -m sdc.runtests -k sdc.tests.test_dataframe.TestDataFrame.test_max*
920+
"""
898921

899922
name = 'max'
900923

0 commit comments

Comments
 (0)