0

i'm working with the following three variables:

columns = ['ticker', 'avg range', 'std of range', '0.5 std range', 'median range', 'highest range', 'lowest range']

After creating a variable containing the title for 7 columns, i hava two lists with 7 items to equal the amount of columns that are created.

eu_5dstats = [stats_list("EUR_USD","D",5)] gu_5dstats = [stats_list("GBP_USD","D",5)]

I would like to create a table with two rows, which fills each column with the items in the eu_5dstats and gu_5dstats variables.

when i try eutable = pd.DataFrame(eu_5dstats,columns=[columns]) this works fine, and gives me the following table.

However when I try to add more rows by adding the other list by using table = pd.DataFrame([eu_5dstats, gu_5dstats], columns=[columns]) i get the following:

Screenshot of my code's current output

when i try table = pd.DataFrame(zip(eu_5dstats, gu_5dstats), columns=[columns]) i get a** ValueError: 7 columns passed, passed data had 2 columns**.

I would like a table with 2 rows. The first row will be the list from eu_5dstats variable, and the second row with values from the gu_5dstats variable. Like this:

Screenshot of the result I would like

can someone please propose an alternative solution?

Many thanks

spmf1694
  • 41
  • 3

0 Answers0