I need to extract the same column from multiple DataFrames in a Dictionary and save them as a DataFrame so that each column name is labelled as the key in the Dictionary.
By extracting the 'close' column from each DataFrame in the Dictionary I end up with the Series below:
date | close |
---|---|
2023-03-06 04:00:00 | 1 |
2023-03-06 05:00:00 | 2 |
2023-03-06 06:00:00 | 2 |
And I need to make a DataFrame with n columns that looks like this:
date | SPY | QQQ | SMH |
---|---|---|---|
2023-03-06 04:00:00 | 1 | 3 | 2 |
2023-03-06 05:00:00 | 2 | 4 | 4 |
2023-03-06 06:00:00 | 3 | 2 | 3 |
The number of tickers varies.