'filling missing data in pandas data set
I have annual stock data and some of the years, datas are missing for the columns : at, ebit, lt , ni, re, wcap.
How can I fill these missing slots with the data of the first year where these metrics are available?
Solution 1:[1]
Assume your fyear
is sorted, you can try ffill
then bfill
df = df.ffill().bffil()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ynjxsjmh |