CBSE Class 12 Informatics Practices
Question 166 of 167
Python Pandas — I — Question 20
Back to all questions 20
Question Four dictionaries store the details of four employees-of-the-month as (empno, name). Write a program to create a dataframe from these.
import pandas as pd
emp1 = {'empno': 1001, 'name': 'Ameesha'}
emp2 = {'empno': 1002, 'name': 'Akruti'}
emp3 = {'empno': 1003, 'name': 'Prithvi'}
emp4 = {'empno': 1004, 'name': 'Rajesh'}
employees = [emp1, emp2, emp3, emp4]
df = pd.DataFrame(employees)
print(df) empno name
0 1001 Ameesha
1 1002 Akruti
2 1003 Prithvi
3 1004 Rajesh