creating a dataframe from pairs of columns in Python

Asked

Viewed 43 times

0

Using the yfinance library I imported data from a list of 80 assets:

tickers=['xxx','yyy']
data = yf.download(tickers, start="2020-01-01", end="2020-12-04")
data = data['Close']

I used a function and extracted a list of pairs of those assets. According to my criteria I have selected 88 pairs.

inserir a descrição da imagem aqui

Now I would like a function that creates a dataframe, for later export to Excel, where each Worksheet would receive the name of the pair and the quotes of each asset organized in columns B and C, the column A being reserved for the date.

  • It is not clear to me what you are having to do. What are colums A, B and C? How did you import the object yf?

  • yf is the library of Yahoo Finanace import yfinance as yf Columns A, B and C would be the output columns of each pair(A for date, B for the first asset of the pair and C for the second asset of the pair)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.