Consider the DataFrame Scholarship shown below:
| Name | Course | Amount | |
|---|---|---|---|
| 0 | Ananya | B.Sc. | 62000 |
| 1 | Karan | B.Tech | 67000 |
| 2 | Simran | MCA | 64000 |
| 3 | Rahul | BCA | 70000 |
| 4 | Priya | BA | 69000 |
Answer the following questions:
Write Python code to create and display the given DataFrame using the Dictionary of Series method.
import pandas as pd
Scholarship = pd.DataFrame({
'Name': pd.Series(['Ananya', 'Karan', 'Simran', 'Rahul', 'Priya']),
'Course': pd.Series(['B.Sc.', 'B.Tech', 'MCA', 'BCA', 'BA']),
'Amount': pd.Series([62000, 67000, 64000, 70000, 69000])
})
print(Scholarship) Name Course Amount
0 Ananya B.Sc. 62000
1 Karan B.Tech 67000
2 Simran MCA 64000
3 Rahul BCA 70000
4 Priya BA 69000 Rename row indexes to ['a', 'b', 'c', 'd', 'e']
Scholarship = Scholarship.rename(index={0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e'}) Write Python statement to remove the last row of the given DataFrame
Scholarship.drop('e', inplace=True) Scholarship.drop(Scholarship.index[-1], inplace=True) State whether the following statement is True or False:
In Pandas Series, the Positional index can be a string or an integer.
We can add a new row to a DataFrame DF using the ______ method.
Aditya is working on a DataFrame named df. He has written the statement:
print(df.loc['S2'])What will the above statement do?
In the context of creating a Pandas Series from a dictionary, which of the following statement is correct?