Question: 9 . 1 5 pandas: Create Series from Dictionary Using the same names and grades from the previous lab, create a Python dictionary of key

9.15 pandas: Create Series from Dictionary
Using the same names and grades from the previous lab, create a Python dictionary of key value pairs with student name and grade. Then create a series from your dictionary and print it out.
Then create a Pandas Series that only selects students with a grade of 'B' or 'C' and print it out.
Sample output:
```
Fred 85
Jacqui 96
Tevon 75
Amal 84
Sarah 90
dtype: int64
Fred 85
Jacqui 96
Amal 84
Sarah 90
dtype: int64
```
Remember to import pandas into your program. main.py
```
import pandas as pd
# create a dictionary containing names and grades of students
names_grades ={'Fred': 85, 'Jacqui': 96, 'Tevon': 75, 'Amal': 84, 'Sarah': 90}
# create a pandas series from the dictionary
series = pd.Series(names_grades)
# print the series
print(series)
# print a blank line
print()
# create a series with grades of 'B' or 'C'
# note: A is for 90-100, B is for 80-89, C is for 70-79, D is for 60-69, F is for 0-59..
# so, to fetch grades of B or C, we need to fetch grades between 70 and 89.99, for that below statement
series2= series[(series >=70) & (series 90)]
# print the series
print(series2)
# note: sample output provided is not correct, because the question is to fetch students with grades B (
# the sample output provided contains students with grades A as well.
# if you want to fetch students with at least grade B, then the below statement can be used
# series2= series[series >=70]
```1:Compare output
Output differs. See highlights below.
Special character legend
Your output
Expected output
9 . 1 5 pandas: Create Series from Dictionary

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!