<jupyter_start><jupyter_text>The cell below return a dataframe for each variable<jupyter_code>CB_ind = keyvalues[(keyvalues.key=='CB_ind')]
gllbsc_ind_gap = keyvalues[(keyvalues.key=='gllbsc_ind_gap')]
CB_dir = keyvalues[(keyvalues.key=='CB_dir')]
VB_dir = keyvalues[(keyvalues.key=='VB_dir')]
VB_ind = keyvalues[(keyvalues.key=='VB_ind')]
gllbsc_dir_gap = keyvalues[(keyvalues.key=='gllbsc_dir_gap')]
heat_of_formation = keyvalues[(keyvalues.key=='heat_of_formation_all')]
standard_energy = keyvalues[(keyvalues.key=='standard_energy')]

keyvalues<jupyter_output><empty_output><jupyter_text>The cells below build a dataframe for all the values. id is the ID of the perovskite<jupyter_code>valuelist=[CB_dir,VB_dir,VB_ind,gllbsc_dir_gap,gllbsc_ind_gap,heat_of_formation,standard_energy]
values = CB_ind
for x in valuelist:
    values = pd.merge(values,x,how='outer',on='id')
values.set_index('id',inplace=True)
values.columns=['key','CB_ind','key','CB_dir','key','VB_dir','key','VB_ind','key','gllbsc_dir_gap','key','gllbsc_ind_gap','key','heat_of_formation','key','standard_energy']
values=values.drop(columns='key')<jupyter_output><empty_output><jupyter_text>The cells below build dataframe for A_ion, B_ion and Anion, each dataframe contains the ion's electronegativity and first ionization energyanion's electronegativity and first ionization energy are calculated from average value of each atom<jupyter_code>A_ion = textvalues[(textvalues.key=='A_ion')]
B_ion = textvalues[(textvalues.key=='B_ion')]
anion = textvalues[(textvalues.key=='anion')]

electroneg = pd.read_csv('electronegativity.csv')
electroneg.columns = ['value', 'electronegativity']

A_electroneg=pd.merge(A_ion,electroneg,how='left',on='value')
B_electroneg=pd.merge(B_ion,electroneg,how='left',on='value')

ionization=pd.read_excel('ionization energy.xlsx')

A_values=pd.merge(A_electroneg,ionization,how='left',on='value')
B_values=pd.merge(B_electroneg,ionization,how='left',on='value')

#affinity = pd.read_excel('electron affinities.xlsx')

A_values.columns=['key','A_ion','id','A_X','A_IE']
B_values.columns=['key','B_ion','id','B_X','B_IE']

cation_values=pd.merge(A_values,B_values,how='outer',on='id')

cation_values.head()
anion_electronegativity=[3.04,3.62,3.30666,3.15333,3.44,3.48666,3.17333]
#this is calculated from the average of atom's electronegativity
anion_ionization=[14.53414,14.88631,13.92342,12.53204,13.61806,15.19167,14.22878]
#this is calculated from the average of atom's ionization
anion_data = pd.DataFrame({'value':['N3','O2F','O2N','O2S','O3','OFN','ON2'],'electronegativity':anion_electronegativity,'first ionization energy':anion_ionization})
anion_data
anion_values=pd.merge(anion,anion_data,how='left',on='value')
anion_values.columns=['key','anion','id','anion_X','anion_IE']
perovskite_values=pd.merge(anion_values,cation_values,how='outer',on='id')<jupyter_output><empty_output><jupyter_text>The cell below get two dataframe: mass and volumeid is the ID of perovskite<jupyter_code>volume = pd.DataFrame({'id': systems.id, 'volume':systems.volume})
mass = pd.DataFrame({'id': systems.id, 'mass':systems.mass})
volume.head()
perovskite=pd.merge(perovskite_values,volume,how='left',on='id')
perovskite=pd.merge(perovskite,mass,how='left',on='id')
perovskite=perovskite.drop(columns=['key','key_x','key_y'])
perovskite.set_index('id',inplace=True)
perovskite['density']=perovskite['mass']/perovskite['volume']<jupyter_output><empty_output><jupyter_text>In above dataframe, X represents electronegativity, IE represents Ionization Energy.Density is calculated from mass/volume<jupyter_code>perovskite.head()
# remove all the NaN data
values = values[(values.CB_ind > 0.0)]
values.head()
values[(values.gllbsc_dir_gap > 0.0)].count()<jupyter_output><empty_output><jupyter_text>only 735 lines positive bandgap data<jupyter_code>data_total=pd.merge(perovskite,values,how='outer',left_index=True,right_index=True)
data_total.head()<jupyter_output><empty_output><jupyter_text>the dataframe 'data_total' is a collection of all the data  Neural networks<jupyter_code>traindata,testdata = train_test_split(data_total)
traindata.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15998078308911842, 'fraction_numerical': 0.022820081671871245, 'mean_word_length': 12.219047619047618, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '329097', 'license': 'MIT', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1535, 'n_words': 204, 'path': '.ipynb_checkpoints/Neural networks-checkpoint.ipynb', 'repo_name': 'xqzh/Perovskite', 'size': '4163'}