Python Pandas program to convert a list of lists into a Dataframe

In this python pandas program, we will convert a list of lists into a Dataframe using the pandas library.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create a list of lists.
  3. Now convert the list of lists into a dataframe using pd.DataFrame().
  4. 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
				
			

get the datatypes of columns of a DataFrame

find the index of a column from the DataFrame

Leave a Comment