Converting a dictionary

Report a typo

Suppose you have a dictionary capitals that stores capitals of different countries (country names are keys and the names of the capitals are values).

Define a function that creates and returns a Series object that stores values from the capitals with country names as indexes. Also, set the name of the Series to Capitals of the world.

In the end, return the resulting Series.

For example, suppose that:

capitals = {'Czech Republic': 'Prague', 
            'Russia': 'Moscow', 
            'Australia': 'Canberra'}

Then, your function should return the following Series:

Czech Republic      Prague
Russia              Moscow
Australia           Canberra
Name: Capitals of the world, dtype: object
Write a program in Python 3
import pandas as pd

def create_series(capitals):
pass
___

Create a free account to access the full topic