@@ -142,21 +142,22 @@ def read_file(self) -> pd.DataFrame:
142142 )
143143 # We use the NUBASE data to define whether or not an isotope is experimentally measured,
144144 df ['Experimental' ] = ~ df ["NUBASEMassExcess" ].astype ("string" ).str .contains ('#' , na = False )
145+ # Once we have used the '#' to determine if it's experimental or not, we can remove all instances of it
145146 df .replace ("#" , "" , regex = True , inplace = True )
146147
147148 df ["TableYear" ] = self .year
148149 df ["N" ] = pd .to_numeric (df ["A" ]) - pd .to_numeric (df ["Z" ])
149150 df ["Symbol" ] = pd .to_numeric (df ["Z" ]).map (self .z_to_symbol )
150151 # For the moment, we will ignore anything this is not the ground state
151152 df = df [df ["State" ] == 0 ]
152- # As 'State' is now necessarily 0 and the Isomer columns are empty. Drop them.
153+ # As 'State' is now necessarily 0 and the Isomer columns are empty, drop them.
153154 df = df .drop (columns = ['State' , 'IsomerEnergy' , 'IsomerEnergyError' ])
154155
155156 # Convert stable isotopes into ones with enormous lifetimes with zero error so we can cast
156157 df .loc [df ['HalfLifeValue' ] == 'stbl' , ['HalfLifeValue' , 'HalfLifeUnit' , 'HalfLifeError' ]] = [99.99 , 'Zy' , 0.0 ]
157158
158159 df ['HalfLifeValue' ] = df ['HalfLifeValue' ].astype ("string" ).str .replace (r'[<>?~]' ,'' , regex = True )
159- # We'll be lazy here an remove any characters in this column. Future us will parse this properly
160+ # We'll be lazy here and remove any characters in this column. Future us will parse this properly
160161 df ['HalfLifeError' ] = df ['HalfLifeError' ].astype ("string" ).str .replace (r'[<>?~a-z]' ,'' , regex = True )
161162
162163 return df .astype (self ._data_types ())
0 commit comments