Skip to main content

Program toCreating Pandas dataframe using list of lists

· One min read
Kaustubh Kulkarni

Code >

file.py
import pandas as pd
data = [['Python','Basics',5], ['Python', 'OOPs',6], ['Python','Exception Handling',2] ,
['Python', 'Database',4],
['Python', 'REgular Expressions',3],
['Python', 'Data Analysis',6] ]
df = pd.DataFrame(data, columns = ['Category', 'Name','No of lecture'])
print(df )

Output >

Output
Category              Name            No of lecture
Python Basics 5
Python OOPs 6
Python Exception Handling 2
Python Database 4
Python REgular Expressions 3
Python Data Analysis 6