Q. What is the output of the following code?


data = {'age': [20, 23, 22), 'name': [ 'Ruhi', 'Ali', 'Sam']}

dfi = pd.DataFrame (data, index=[1, 2, 3])

print("Before")

print (df1)

df1['Edu'] = ['BA', 'BE', 'MBA']

print("After")

print(df1)


Answer =

Output:-

Before

   age  name
1   20  ruhi
2   23    al
3   22   sam

After

   age  name  Edu
1   20  ruhi   BA
2   23    al   BE
3   22   sam  MBA

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post