I have a list (sub_indices) that contains dataframe index values. Using these index values I need to make changes in other dataframe (main_df). Changes must be done on these index values that are in a list. What should be the best way to solve this task? I'v tried lambda and map functions but getting an error: "AttributeError: ("'list' object has no attribute 'apply'", 'occurred at index 0')". Seems that lambda function cannot be called on a list.
def function_1(new_value): sub_indices = sub_df.index.values.tolist() sub_indices.apply(lambda x: function_2(x)) def function_2(df_indices): # Replacement that needs to be done. 'indes_value' is the next element from 'sub_indices' list. main_df.at[indes_value, 'column_name'] = "new value"