I have several lists and I want to create only one Dataframe to later export.
The lists are of the type:
a=[1, 2, 3, 4, 5, 6, 7, 8]
b=[9, 10, 11, 12, 13, 14, 15, 16]
For this I am creating 2 dataframes as follows:
export=pd.DataFrame(a, columns=['A'])
export2=pd.DataFrame(b, columns=['B'])
My problem is that I have many lists and I would like to make only one Dataframe like this:
export=pd.DataFrame(a, b, columns=['A', 'B'])
But it throws me an error, of dimension:
ValueError: Shape of passed values is (1, 600), indices imply (2, 576)
It doesn't work for you because you are passing a list that is somehow like a matrix of 8 columns and one row, your Dataframe has 2 columns 'A' and 'B', so there is no dimension match.
Here are several ways to do the same:
EDIT: proposed by @kikocorreoso.
The interesting thing is if the data you have, you need to join them by some criterion of the table itself.