Advertisements
Advertisements
Question
Write the output of the following code:
import pandas as pd
states = pd.Series(['Maharashtra', 'Gujarat', 'Kerala'])
capitals = pd.Series(['Mumbai', 'Gandhinagar', 'Thiruvananthapuram'])
data = {'State': states, 'Capital': capitals}
df = pd.DataFrame(data)
df.drop(index=1, inplace=True)
print(df)Very Short Answer
Advertisements
Solution
| State | Capital | |
| 0 | Maharashtra | Mumbai |
| 2 | Kerala | Thiruvananthapuram |
shaalaa.com
Is there an error in this question or solution?
