def get_table(results, letter): y = "Δ{}".format(letter) df = Table( RecursiveDict([("δ", results[0]), (y, results[1]), (y + "ₑᵣᵣ", results[2])])) x0, x1 = map(float, df["δ"].iloc[[0, -1]]) pad = 0.15 * (x1 - x0) mask = (results[3] > x0 - pad) & (results[3] < x1 + pad) x, fit = results[3][mask], results[4][mask] df.set_index("δ", inplace=True) df2 = pd.DataFrame(RecursiveDict([("δ", x), (y + " Fit", fit)])) df2.set_index("δ", inplace=True) cols = ["δ", y, y + "ₑᵣᵣ", y + " Fit"] return (pd.concat([df, df2], sort=True).sort_index().reset_index().rename(columns={ "index": "δ" }).fillna("")[cols])
def get_table(results, letter): y = 'Δ{}'.format(letter) df = Table(RecursiveDict([ ('δ', results[0]), (y, results[1]), (y+'ₑᵣᵣ', results[2]) ])) x0, x1 = map(float, df['δ'].iloc[[0,-1]]) pad = 0.15 * (x1 - x0) mask = (results[3] > x0 - pad) & (results[3] < x1 + pad) x, fit = results[3][mask], results[4][mask] df.set_index('δ', inplace=True) df2 = pd.DataFrame(RecursiveDict([ ('δ', x), (y+' Fit', fit) ])) df2.set_index('δ', inplace=True) cols = ['δ', y, y+'ₑᵣᵣ', y+' Fit'] return pd.concat([df, df2], sort=True).sort_index().reset_index().rename( columns={'index': 'δ'}).fillna('')[cols]
def get_table(results, letter): y = 'Δ{}'.format(letter) df = Table( RecursiveDict([('δ', results[0]), (y, results[1]), (y + 'ₑᵣᵣ', results[2])])) x0, x1 = map(float, df['δ'].iloc[[0, -1]]) pad = 0.15 * (x1 - x0) mask = (results[3] > x0 - pad) & (results[3] < x1 + pad) x, fit = results[3][mask], results[4][mask] df.set_index('δ', inplace=True) df2 = pd.DataFrame(RecursiveDict([('δ', x), (y + ' Fit', fit)])) df2.set_index('δ', inplace=True) cols = ['δ', y, y + 'ₑᵣᵣ', y + ' Fit'] return pd.concat([df, df2], sort=True).sort_index().reset_index().rename(columns={ 'index': 'δ' }).fillna('')[cols]