Question: What will the following code print? import pandas as pd data = { ' A ' : [ 1 , 2 , 3 ] ,

What will the following code print?
import pandas as pd
data ={'A': [1,2,3],'B': [4,5,6]}
df = pd.DataFrame(data)
df['C']= df['A']+ df['B']
print(df)
What will the following code print?
import pandas as pd
data ={'A': [1,2,3],'B': [4,5,6]}
df = pd.DataFrame(data)
df['C']= df['A']+ df['B']
print(df)
It will raise an error.
DataFrame with columns 'A','B','C' and values [1,2,3],[4,5,6],[9,7,5].
A DataFrame with columns 'A','B','C' and values [1,2,3],[4,5,6],[5,7,9].
A DataFrame with columns 'A','B' only.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!