# SQL output is imported as a pandas dataframe variable called "df"

# Source:  https://stackoverflow.com/questions/19441730/trimmed-mean-with-percentage-limit-in-python
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import tmean, scoreatpercentile
import numpy as np

def trimmean(arr, percent):
    lower_limit = scoreatpercentile(arr, percent)
    upper_limit = scoreatpercentile(arr, 100-percent)
    return tmean(arr, limits=(lower_limit, upper_limit), inclusive=(False, False))

my_result = trimmean(df["amt_paid"].values,10)
[(10, 'scipy.stats.scoreatpercentile', 'scoreatpercentile', False, 'from scipy.stats import tmean, scoreatpercentile\n'), (11, 'scipy.stats.scoreatpercentile', 'scoreatpercentile', False, 'from scipy.stats import tmean, scoreatpercentile\n'), (12, 'scipy.stats.tmean', 'tmean', False, 'from scipy.stats import tmean, scoreatpercentile\n')]