This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
def describe(x): | |
data = [np.mean(x), x.std(), x.median() - x.quantile(0.25), | |
x.median(), x.quantile(0.75) - x.median(), np.sum(x)] | |
names = ['mean', 'std', '-err', '50%', '+err', 'sum'] | |
return pd.DataFrame(data, index=names).T | |
#functional call |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def weighted_median(x, weights): | |
#Sorting item and weights first | |
sort = np.argsort(x) | |
x = x[sort] | |
weights = weights[sort] | |
#Less than cumulative frequencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy.stats as st | |
import numpy as np | |
def err_pdf( loc, scale, size=15, cutoff=5): | |
""" | |
PURPOSE | |
-------- | |
Returns gaussian pdf at grid x that can be used as an error distribution. | |
Here, grid x is linearly spaced between -cutoff to +cutoff sigma of the loc. | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.