ffill() does not fill the last year of observations

67 views Asked by At

I have an issue with Python not filling the months of latest observed year. Does anyone know how to expand the line of code to get the values for all the months of the whole year of 2021?

I understand that our df is not any longer than 2021 and ffill does exactly what I have asked it to do. But is there any way to lengthen it by adding something that says so?

#to monthly scores

    esg_data = esg_data.set_index("datadate")
    esg_data = esg_data.groupby("conm").resample('M').ffill()
    esg_data = esg_data.reset_index(level=0, drop=True).reset_index()

The output of the code can be found from here:

Screenshot of the output

Thanks in advance

Angela

0

There are 0 answers