I was working on this question filter iteration using FOR. I wonder how to replace the last cell of year
column in each csv file generated. Lets say I want to replace the last cell (of column year
) of each cvs file by current year (2018). I did the following code:
for i, g in df.sort_values("year").groupby("Univers", sort=False):
for y in g.iloc[-1, g.columns.get_loc('year')]:
y = 2018
g.to_csv('{}.xls'.format(i))
But I get the same column with any changes. Any ideas how to do this?