Example #1
0
            df_sym_col[cmp['symbol']] = cmp['df_name']

    # Solve each row of the dataframe
    for idx, row in df.iterrows():

        eqns_tosolve = eqns[:]

        # add equation of symbol and its values from provided df
        for col in df_sym_col:
            eqns_tosolve.append(sp.Eq(col, row[df_sym_col[col]]))

        soln = sp.solve(eqns_tosolve)

        if soln:
            print idx, eqns_tosolve, soln
            df.loc[idx, "Calculated Poisson's ratio"] = round(
                soln[0][sp.S('nu')], 2)

    return df


if __name__ == '__main__':
    pd.set_option('display.width', 1000)
    # df1 = pd.read_pickle('39135_BMG.pkl')
    df = CitrineDataRetrieval().get_dataframe(data_set_id=150628,
                                              max_results=50)
    df = df.groupby(['chemicalFormula'], as_index=False).sum()
    print df
    new_df = decorate_dataframe(df)
    print new_df
Example #2
0
        if cmp['catalog_name'] in mech_props:
            eqns.append(sp.Eq(mech_props[cmp['catalog_name']]().equation()))
            df_sym_col[cmp['symbol']] = cmp['df_name']

    # Solve each row of the dataframe
    for idx, row in df.iterrows():

        eqns_tosolve = eqns[:]

        # add equation of symbol and its values from provided df
        for col in df_sym_col:
            eqns_tosolve.append(sp.Eq(col, row[df_sym_col[col]]))

        soln = sp.solve(eqns_tosolve)

        if soln:
            print(idx, eqns_tosolve, soln)
            df.loc[idx, "Calculated Poisson's ratio"] = round(soln[0][sp.S('nu')], 2)

    return df


if __name__ == '__main__':
    pd.set_option('display.width', 1000)
    # df1 = pd.read_pickle('39135_BMG.pkl')
    df = CitrineDataRetrieval().get_dataframe(data_set_id=150628, max_results=50)
    df = df.groupby(['chemicalFormula'], as_index=False).sum()
    print(df)
    new_df = decorate_dataframe(df)
    print(new_df)