I want to iterate over a single column in a pandas dataframe and update cells in that column one by one. In my use-case I want user input to provide the update input.
New solution accesses cells directly reducing performance hit and avoiding potential side effects of iterrows()
.
for index, row in df['Col'].items():
user_input = input("Enter value: ".format(index))
df.at[index, 'Col'] = user_input
for i, row in df.iterrows():
user_input = input('Enter value: ')
df.at[i, 'user_input'] = user_input