CBSE Class 12 Informatics Practices
Question 140 of 167
Python Pandas — I — Question 30
Back to all questionsBefore
age name
1 20 Ruhi
2 23 Ali
3 22 Sam
After
age name Edu
1 20 Ruhi BA
2 23 Ali BE
3 22 Sam MBA
The code utilizes the pandas library in Python to create a DataFrame named df1 using a dictionary data. The df1 DataFrame is printed, showing the initial data. Then, a new column 'Edu' is added to the DataFrame using df1['Edu'] = ['BA', 'BE' , 'MBA']. The updated DataFrame is printed.