# 6 examples of 'pandas median' in Python

Every line of 'pandas median' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

## All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
``37def median_absolute_deviation(data,suspect):38    series=pd.Series(data)39    median=series.median()40    demedians=np.abs(series-median)41    demedian=demedians.median()42    if demedian==0:43        return False44    test=demedians.iget(-1)/demedian45    if test>6:46        return True47    return False``
``995@property996def median(self):997    """Return the median."""998    return 0``
``31def smm(df: pd.DataFrame,32        period: int = 50,33        col: str = pd_utils.CLOSE_COL) -> pd.Series:34    """35    Compute the simple moving median over a given period.3637    :param df: The data frame.38    :param period: The number of days to use.39    :param col: The name of the column to use to compute the median.40    :return: Series containing the simple moving median.4142    """43    temp_series = df[col].rolling(center=False,44                                  window=period,45                                  min_periods=period - 1).median()46    return pd.Series(temp_series, index=df.index, name='smm')``
``213@property214def median(self):215    """216    Median of *k*-mer counts.217    """218    return np.median(self.counts)``
``318def median(self):319    return self.quantiles([0.5])[:,0]``
``26def median(values):27    length = len(values)28    values.sort()29    if length % 2 != 0:30        # Odd number of values, so chose middle one31        return values[length/2]32    else:33        # Even number of values, so mean of middle two34        return mean([values[length/2], values[(length/2)-1]])``