LoslegenKostenlos loslegen

Working with datasets - month totals

In this exercise, we will be exploring a dataset that has multiple sales in one month. We will create a script that will enable us to identify dates within the same month, and combine them into a new month total, and append this to the table.

We will be using the dataset df, which represents data from one of our sales areas. Print it out in the console to have a look at the data. As you can see, there were two sales in March. We will combine these sales into a single month total. We can iterate over the dataset using the .iteritems() method.

We will also be using the .split() method.

Diese Übung ist Teil des Kurses

Financial Forecasting in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Set the index to start at 0
index = ____

# Create the dictionary for the months
tt = {'____': 0, 'Feb': ____, '____': ____}
Code bearbeiten und ausführen