Python pandas.core.nanops.nanmax() Examples

The following are 14 code examples of pandas.core.nanops.nanmax(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.core.nanops , or try the search function .
Example #1
Source File: test_nanops.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_nanmax(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", RuntimeWarning)
            func = partial(self._minmax_wrap, func=np.max)
            self.check_funs(nanops.nanmax, func,
                            allow_str=False, allow_obj=False) 
Example #2
Source File: datetimelike.py    From recruit with Apache License 2.0 5 votes vote down vote up
def max(self, axis=None, skipna=True, *args, **kwargs):
        """
        Return the maximum value of the Array or maximum along
        an axis.

        See Also
        --------
        numpy.ndarray.max
        Index.max : Return the maximum value in an Index.
        Series.max : Return the maximum value in a Series.
        """
        # TODO: skipna is broken with max.
        # See https://github.com/pandas-dev/pandas/issues/24265
        nv.validate_max(args, kwargs)
        nv.validate_minmax_axis(axis)

        mask = self.isna()
        if skipna:
            values = self[~mask].asi8
        elif mask.any():
            return NaT
        else:
            values = self.asi8

        if not len(values):
            # short-circut for empty max / min
            return NaT

        result = nanops.nanmax(values, skipna=skipna)
        # Don't have to worry about NA `result`, since no NA went in.
        return self._box_func(result)


# -------------------------------------------------------------------
# Shared Constructor Helpers 
Example #3
Source File: numpy_.py    From recruit with Apache License 2.0 5 votes vote down vote up
def max(self, axis=None, out=None, keepdims=False, skipna=True):
        nv.validate_max((), dict(out=out, keepdims=keepdims))
        return nanops.nanmax(self._ndarray, axis=axis, skipna=skipna) 
Example #4
Source File: base.py    From recruit with Apache License 2.0 5 votes vote down vote up
def max(self, axis=None, skipna=True):
        """
        Return the maximum value of the Index.

        Parameters
        ----------
        axis : int, optional
            For compatibility with NumPy. Only 0 or None are allowed.
        skipna : bool, default True

        Returns
        -------
        scalar
            Maximum value.

        See Also
        --------
        Index.min : Return the minimum value in an Index.
        Series.max : Return the maximum value in a Series.
        DataFrame.max : Return the maximum values in a DataFrame.

        Examples
        --------
        >>> idx = pd.Index([3, 2, 1])
        >>> idx.max()
        3

        >>> idx = pd.Index(['c', 'b', 'a'])
        >>> idx.max()
        'c'

        For a MultiIndex, the maximum is determined lexicographically.

        >>> idx = pd.MultiIndex.from_product([('a', 'b'), (2, 1)])
        >>> idx.max()
        ('b', 2)
        """
        nv.validate_minmax_axis(axis)
        return nanops.nanmax(self._values, skipna=skipna) 
Example #5
Source File: test_nanops.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_nanmax(self):
        with warnings.catch_warnings(record=True):
            func = partial(self._minmax_wrap, func=np.max)
            self.check_funs(nanops.nanmax, func,
                            allow_str=False, allow_obj=False) 
Example #6
Source File: base.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def max(self):
        """
        Return the maximum value of the Index.

        Returns
        -------
        scalar
            Maximum value.

        See Also
        --------
        Index.min : Return the minimum value in an Index.
        Series.max : Return the maximum value in a Series.
        DataFrame.max : Return the maximum values in a DataFrame.

        Examples
        --------
        >>> idx = pd.Index([3, 2, 1])
        >>> idx.max()
        3

        >>> idx = pd.Index(['c', 'b', 'a'])
        >>> idx.max()
        'c'

        For a MultiIndex, the maximum is determined lexicographically.

        >>> idx = pd.MultiIndex.from_product([('a', 'b'), (2, 1)])
        >>> idx.max()
        ('b', 2)
        """
        return nanops.nanmax(self.values) 
Example #7
Source File: test_nanops.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_nanmax(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", RuntimeWarning)
            func = partial(self._minmax_wrap, func=np.max)
            self.check_funs(nanops.nanmax, func,
                            allow_str=False, allow_obj=False) 
Example #8
Source File: datetimelike.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def max(self, axis=None, skipna=True, *args, **kwargs):
        """
        Return the maximum value of the Array or maximum along
        an axis.

        See Also
        --------
        numpy.ndarray.max
        Index.max : Return the maximum value in an Index.
        Series.max : Return the maximum value in a Series.
        """
        # TODO: skipna is broken with max.
        # See https://github.com/pandas-dev/pandas/issues/24265
        nv.validate_max(args, kwargs)
        nv.validate_minmax_axis(axis)

        mask = self.isna()
        if skipna:
            values = self[~mask].asi8
        elif mask.any():
            return NaT
        else:
            values = self.asi8

        if not len(values):
            # short-circut for empty max / min
            return NaT

        result = nanops.nanmax(values, skipna=skipna)
        # Don't have to worry about NA `result`, since no NA went in.
        return self._box_func(result)


# -------------------------------------------------------------------
# Shared Constructor Helpers 
Example #9
Source File: numpy_.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def max(self, axis=None, out=None, keepdims=False, skipna=True):
        nv.validate_max((), dict(out=out, keepdims=keepdims))
        return nanops.nanmax(self._ndarray, axis=axis, skipna=skipna) 
Example #10
Source File: base.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def max(self, axis=None, skipna=True):
        """
        Return the maximum value of the Index.

        Parameters
        ----------
        axis : int, optional
            For compatibility with NumPy. Only 0 or None are allowed.
        skipna : bool, default True

        Returns
        -------
        scalar
            Maximum value.

        See Also
        --------
        Index.min : Return the minimum value in an Index.
        Series.max : Return the maximum value in a Series.
        DataFrame.max : Return the maximum values in a DataFrame.

        Examples
        --------
        >>> idx = pd.Index([3, 2, 1])
        >>> idx.max()
        3

        >>> idx = pd.Index(['c', 'b', 'a'])
        >>> idx.max()
        'c'

        For a MultiIndex, the maximum is determined lexicographically.

        >>> idx = pd.MultiIndex.from_product([('a', 'b'), (2, 1)])
        >>> idx.max()
        ('b', 2)
        """
        nv.validate_minmax_axis(axis)
        return nanops.nanmax(self._values, skipna=skipna) 
Example #11
Source File: base.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def max(self):
        """ The maximum value of the object """
        return nanops.nanmax(self.values) 
Example #12
Source File: test_nanops.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_nanmax(self):
        func = partial(self._minmax_wrap, func=np.max)
        self.check_funs(nanops.nanmax, func, allow_str=False, allow_obj=False) 
Example #13
Source File: base.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def max(self):
        """ The maximum value of the object """
        return nanops.nanmax(self.values) 
Example #14
Source File: test_nanops.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_nanmax(self):
        with warnings.catch_warnings(record=True):
            func = partial(self._minmax_wrap, func=np.max)
            self.check_funs(nanops.nanmax, func,
                            allow_str=False, allow_obj=False)