My input data frame df is below
external_id
sw_1
sw_2
sw_3
Sw_55
and my output data frame output_df should be
external_id : Status
sw_1 :Hello Sw_1
sw_2 :Hello sw_2
sw_3 :hello sw_3
Sw_55 :Hello sw_55
Till now I have done this. Able to create new df for for loop output only. I want to store for loop result in existing data frame.
df = pd.read_csv(r'/Users/man/Desktop/input.csv')
output_df = df.copy()
output_df['Status'] = ""
list2 = []
for i in df['external_id']:
x = "Hello " + i
list2.append(x)
df1 = pd.DataFrame(list2)
print(df1)
Actually I have input data frame which contains external_id
and I want to call API for each external_id
and then store result of api call (status_code and API response) in existing data frame against of each external_id
.