text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

train = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')
sub = pd.read_csv('../input/sample_submission.csv')

structures = pd.read_csv('input/structures.csv')

train = pd.merge(train, structures[['molecule_name', 'atom_index', 'atom']], how='left', left_on=['molecule_name', 'atom_index_0'], right_on=['molecule_name', 'atom_index']).rename({'atom': 'atom_0'}, axis=1)
train = pd.merge(train, structures[['molecule_name', 'atom_index', 'atom']], how='left', left_on=['molecule_name', 'atom_index_1'], right_on=['molecule_name', 'atom_index']).rename({'atom': 'atom_1'}, axis=1)
test = pd.merge(test, structures[['molecule_name', 'atom_index', 'atom']], how='left', left_on=['molecule_name', 'atom_index_0'], right_on=['molecule_name', 'atom_index']).rename({'atom': 'atom_0'}, axis=1)
test = pd.merge(test, structures[['molecule_name', 'atom_index', 'atom']], how='left', left_on=['molecule_name', 'atom_index_1'], right_on=['molecule_name', 'atom_index']).rename({'atom': 'atom_1'}, axis=1)