How can I replace the NaN in my table for daily stock return?
Working with Pandas, it works just by using
df.fillna(0)
I am calculating daily returns of a stock, as you can see in the first day (06/01) there is no return, that is ok, but i want to replace that NaN for a 0, I tried the fillna() function but it does not work
Attributes Adj Close     Close      High       Low      Open    Volume
Symbols         nvda      nvda      nvda      nvda      nvda      nvda
Date
2021-06-01       NaN       NaN       NaN       NaN       NaN       NaN
2021-06-02  0.031587  0.031587  0.032371  0.020892 -0.001091  0.256690
2021-06-03  0.011414  0.011414  0.020111  0.021404  0.027596 -0.023832
2021-06-04  0.035858  0.035858  0.023292  0.030905  0.024655  0.062834
2021-06-07  0.002318  0.002318  0.008578  0.005689  0.026808 -0.066016