The three columns on the left are day month, and year. I am trying to fill in NaN
values in the last column which I am calling 'C'
. For each week of each month there is one non-empty value in the last column, and I would like to assign the NaN
values with the non-empty value.
So far I have tried doing it with the first week with the following code:
for year in range(2013, 2023):
for month in range(1, 13):
for day in range(1, 8):
df.loc[pd.isnull(df['C']), 'C'] = df.loc[(df['year'] == year) & (df['month'] == month) & (df['day'] == 3), 'C']