{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\n\n\n\n#dir_folder=\"input/Predicting Molecular Properties\"\n# Read the file containing the molecular structures\ndf_structures = pd.read_csv(\"../input/champs-scalar-coupling/structures.csv\")\ndf_structures.head()\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train=pd.read_csv(\"../input/champs-scalar-coupling/train.csv\")\ndf_train.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_test=pd.read_csv(\"../input/champs-scalar-coupling/test.csv\")\ndf_test.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_dipole_moments=pd.read_csv(\"../input/champs-scalar-coupling/dipole_moments.csv\")\ndf_dipole_moments.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def combine_molecule_structure(data: pd.DataFrame):\n    atom_idx=[0,1]\n    for idx in atom_idx:\n        data = data.merge( df_structures, how='left',\n                  left_on = ['molecule_name', f'atom_index_{idx}'],\n                  right_on = ['molecule_name', 'atom_index'])\n        \n        data= data.drop('atom_index', axis=1)\n        data=data.rename(columns={'atom': f'atom_{idx}',\n                                    'x': f'x_{idx}',\n                                    'y': f'y_{idx}',\n                                    'z': f'z_{idx}'})\n        return data\n                   ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train=combine_molecule_structure(df_train)\ndf_train.head\n","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":1}