Just finished the REIT Stock Analysis project, as part of the Python Financial Data skill path, I’m really starting to get the hang of it!
I think the project had a few mistakes in design though, when I calculate the simple and log rate of returns using the functions I build during the project, the first element in the array is “nan” since we are using the np.diff() function.
Because of that, during the project when asked to use np.mean(), np.var(), np.std() and np.corrcoef(), all the results display nan, nan, nan…
At first I found a way around it by using np.nanmean(), np.nanvar() and np.nanstd() but at the end I couldn’t find the same nan function for np.corrcoef(), so I went back and used this method to remove the nan from the first element:
not_nan_array = ~(np.isnan(daily_log_returns_sbra))
daily_log_returns_sbra = daily_log_returns_sbra[not_nan_array]
I eventually got it but I think this project should be updated since its not an easy thing to solve assuming you only posses knowledge from this course which doesn’t cover that.
I’ve included a link to GitHub with my solution for this project:
Enjoying the courses and the projects!