I wanted to change a contiguous block of row values in one column in one go.
In the end I ended up with this that does the job but I kinda think there must be a neater way.
df = pd.read_excel('ja.xlsx')
df # echo the contents of the df
for index, row in df.iterrows():
if index < 4:
df.loc[ index, "my_col_name"] = 'yes'
else:
df.loc[ index, "my_col_name"] = 'no'
any suggestions?
Thanks!