Я попытался создать минимальный пример из вашей информации со следующим кодом:
well_name = ['a','b','c','d','e','f','g']
deep_wells = ['a','c','g']
shallow_wells = ['b','d','e','f']
lin_reg_df = pd.DataFrame({'Surface_Elevation_mAHD ': [1,2,3,4,5,6,7],
'Adopted_SS_WL': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]})
lin_reg_df.index = well_names
, поэтому мой DataFrame изначально выглядит так:
Surface_Elevation_mAHD Adopted_SS_WL
a 1 0.1
b 2 0.2
c 3 0.3
d 4 0.4
e 5 0.5
f 6 0.6
g 7 0.7
Я бы тогда просто использовал это фрагмент кода для выполнения работы:
for well in well_name:
if well in deep_wells:
lin_reg_df.loc[well, 'Aquifier_Type'] = 'deep'
elif well in shallow_wells:
lin_reg_df.loc[well, 'Aquifier_Type'] = 'shallow'
Вывод будет:
Surface_Elevation_mAHD Adopted_SS_WL Aquifier_Type
a 1 0.1 deep
b 2 0.2 shallow
c 3 0.3 deep
d 4 0.4 shallow
e 5 0.5 shallow
f 6 0.6 shallow
g 7 0.7 deep