apply a function to each row of the dataframe
问题 What is a more elegant way of implementing below? I want to apply a function: my_function to a dataframe where each row of the dataframe contains the parameters of the function. Then I want to write the output of the function back to the dataframe row. results = pd.DataFrame() for row in input_panel.iterrows(): (index, row_contents) = row row_contents['target'] = my_function(*list(row_contents)) results = pd.concat([results, row_contents]) 回答1: We'll iterate through the values and build a