Adding elements to a Series

Report a typo

Imagine you have a Series called olympics that stores the names of the cities hosting the Summer Olympics between 2000 and 2016. The index is set to the year of the games (as an integer), and the city names are represented as strings. Here is a fragment of the Series:

2000            Sydney
2004            Athens
...
2016            Rio de Janeiro
dtype: object

The next games will take place in Tokyo (2021), Paris (2024), and Los Angeles (2028).

Complete the add_records() function that adds these three records to olympics and returns the resulting Series object. You don't have to call the add_records() or use any print() statements.

Hint

Review the Modifying a Series object section of the theory and take a closer look at the pd.concat() documentation.

Write a program in Python 3
import pandas as pd

def add_records(olympics):
pass
___

Create a free account to access the full topic