Learn practical skills, build real-world projects, and advance your career

Consumer Prices Example

Author: Andreas Traut

In this example I downloaded the consumer price index from the official website (www.statistikdaten.bayern.de) and worked on these data. I needed to convert months (e.g. "January") to a valid date. Because of my German-Switzerland locale setting I needed to convert and numbers to float (which is replacing comma by point).

Import csv file from the following link and delete first rows (which contain descriptions):

https://www.statistikdaten.bayern.de/genesis/online?sequenz=statistikTabellen&selectionname=61111
     Code: 61111-202z	
     Inhalt: "Verbraucherpreisindex (2015=100): Bayern, Verbraucherpreise, Monate, Jahre"

The format of the CSV file is as follows:

1970	Januar	29,6
1970	Februar	29,7
1970	März	29,8
1970	April	29,8
1970	Mai	    29,9
1970	Juni	30,0
1970	Juli	30,0
import pandas as pd
from matplotlib import pyplot, dates
from matplotlib.ticker import FuncFormatter
import seaborn as sns
from time import strptime
import locale
locale.setlocale(locale.LC_ALL, '')
'German_Switzerland.1252'