Q. What is the output of the following code?


d = {'col1': [1, 4, 3 ], 'col2': [6, 7, 8], 'col3': [9, 0, 1]}

df = pd. DataFrame(d)

print ("Original DataFrame")

print(df)

print("New DataFrame :")

dfn = df.drop(df.index[[1,2]])

print(dfn)


Answer =

Output:-

Original DataFrame

   col1  col2  col3
0     1     6     9
1     4     7     0
2     3     8     1

New DataFrame :

   col1  col2  col3
0     1     6     9

Post a Comment

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

Previous Post Next Post