I'm looking to create a variance/covariance matrix or a correlation matrix (I don't care which) on stock data.
The issue is that different symbols trade at different times, so my dataframe is not full.
How would I generate a covariance matrix on a dataset that has a timestamp column, and where some entries are null.
Here would be an example.
timestamp usdjpy AAPL NIKKEI0 2021-01-01 00:00:00 4 NaN NaN1 2021-01-01 00:05:00 5 5 NaN2 2021-01-01 00:10:00 6 6 93 2021-01-01 00:15:00 4 2 44 2021-01-01 00:20:00 2 NaN 35 2021-01-01 00:25:00 7 NaN 7
What I would want here is the covariance between usdjpy and aapl to be computed on their overlapping timestamps.