In this python pandas program, we will convert a list of lists into a Dataframe using the pandas library.
Steps to solve the program
- Import pandas library as pd.
- Create a list of lists.
- Now convert the list of lists into a dataframe using pd.DataFrame().
- Print the output.
import pandas as pd
l = [['Virat','cricket'],['Messi','football']]
df = pd.DataFrame(l)
print(df)
Output :
0 0 1
0 Virat cricket
1 Messi football