def _create():
def creator(group):<EOL><INDENT>"""<STR_LIT>"""<EOL>symbol = group['<STR_LIT>'].values[<NUM_LIT:0>]<EOL>try:    <EOL><INDENT>mass = (group['<STR_LIT>']*group['<STR_LIT>']).sum()<EOL>afm = group['<STR_LIT>'].sum()<EOL>if afm > <NUM_LIT:0.0>:<EOL><INDENT>mass /= afm<EOL><DEDENT><DEDENT>except ZeroDivisionError:<EOL><INDENT>mass = group['<STR_LIT>'].mean()<EOL><DEDENT>znum = group['<STR_LIT>'].max()<EOL>cov_radius = group['<STR_LIT>'].mean()<EOL>van_radius = group['<STR_LIT>'].mean()<EOL>try:<EOL><INDENT>color = group.loc[group['<STR_LIT>'].idxmax(), '<STR_LIT>']<EOL><DEDENT>except TypeError:<EOL><INDENT>color = group['<STR_LIT>'].values[<NUM_LIT:0>]<EOL><DEDENT>name = group['<STR_LIT:name>'].values[<NUM_LIT:0>]<EOL>ele = Element(symbol, name, mass, znum, cov_radius, van_radius, color)<EOL>for tope in group.apply(lambda s: Isotope(*s.tolist()), axis=<NUM_LIT:1>):<EOL><INDENT>setattr(ele, "<STR_LIT:_>"+str(tope.A), tope)<EOL><DEDENT>return ele<EOL><DEDENT>iso = _rj(_E(_path).to_stream())<EOL>iso.columns = _columns<EOL>setattr(_this, "<STR_LIT>", iso)<EOL>for element in iso.groupby("<STR_LIT>").apply(creator):<EOL><INDENT>setattr(_this, element.symbol, element)<EOL><DEDENT>
Globally called function for creating the isotope/element API.