Exercise

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.

Instructions 1/2

undefined XP
    1
    2
  • Set index to 0, and create a dictionary for the relevant months, called tt in the following format: {'Month': 0,} for Jan, Feb, and Mar.