xorbits.pandas.Series.median#

Series.median(axis=None, skipna=True, out=None, overwrite_input=False, keepdims=False)[source]#

Return the median of the values over the requested axis.

Parameters
  • axis ({index (0)}) –

    Axis for the function to be applied on. For Series this parameter is unused and defaults to 0.

    For DataFrames, specifying axis=None will apply the aggregation across both axes.

    New in version 2.0.0(pandas).

  • skipna (bool, default True) – Exclude NA/null values when computing the result.

  • numeric_only (bool, default False (Not supported yet)) – Include only float, int, boolean columns. Not implemented for Series.

  • **kwargs – Additional keyword arguments to be passed to the function.

Returns

  • scalar or scalar – .. rubric:: Examples

    >>> s = pd.Series([1, 2, 3])  
    >>> s.median()  
    2.0
    

    With a DataFrame

    >>> df = pd.DataFrame({'a': [1, 2], 'b': [2, 3]}, index=['tiger', 'zebra'])  
    >>> df  
           a   b
    tiger  1   2
    zebra  2   3
    >>> df.median()  
    a   1.5
    b   2.5
    dtype: float64
    

    Using axis=1

    >>> df.median(axis=1)  
    tiger   1.5
    zebra   2.5
    dtype: float64
    

    In this case, numeric_only should be set to True to avoid getting an error.

    >>> df = pd.DataFrame({'a': [1, 2], 'b': ['T', 'Z']},  
    ...                   index=['tiger', 'zebra'])
    >>> df.median(numeric_only=True)  
    a   1.5
    dtype: float64
    
  • Extra Parameters

  • —————-

  • out (Tensor, default None) – Output tensor in which to place the result. It must have the same shape and buffer length as the expected output, but the type (of the output) will be cast if necessary.

  • overwrite_input (bool, default False) – Just for compatibility with Numpy, would not take effect.

  • keepdims (bool, default False) – If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original arr.

This docstring was copied from pandas.core.series.Series.