Reputation: 832
I want to add two or more lists/ pandas series row wise to make a dataframe, how do I do that? for example, Inputs=
a=[1,2,3,4]
b=[9,8,7,6]
(Or pandas series can be there)
Desired output =
1 2 3 4
9 8 7 6
Upvotes: 1
Views: 861
Reputation: 862611
Create list of lists/Series and pass to DataFrame
constructor:
L = [a,b]
df = pd.DataFrame(L)
print (df)
0 1 2 3
0 1 2 3 4
1 9 8 7 6
Upvotes: 2