I have several list:
a = [1, 2, 3, 4]
b = [5, 6, 7, 8]
c = [7, 8, 9, 10]
I would like a dataframe with 3 columns named automatically using names of the lists
a b c
1 5 7
2 6 8
3 7 9
4 8 10
How to do this? Thank you.
You can create a Pandas DataFrame from a list using the code below:
import pandas as pd
a = [1, 2, 3, 4]
b = [5, 6, 7, 8]
c = [7, 8, 9, 10]
df = pd.DataFrame(list(zip(a, b, c)),
columns =['a', 'b', 'c'])
print(df)
Hope this helps!