From the course: Python for Marketing (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Importing Google Analytics data

Importing Google Analytics data - Python Tutorial

From the course: Python for Marketing (2019)

Importing Google Analytics data

- [Instructor] Let's jump right into things. The libraries you need to have installed before using this notebook are pandas and pytrends. You import pandas as pd and pytrends, from pytrends.request import TrendReq. There's also a magic command in there, magic matplotlib.inline. This is what allows us to plot charts in the notebook. If I run this I get no errors and everything is good to go. The first thing I want to do here, is load in a Google Analytics CSV. So we will do this by creating a variable, you can name it whatever you like. I've named it ga_data and that equals pd, so that says calling pandas, we're looking up the function read_csv, and then we're telling read_csv where the CSV file is that we want it to read. If I run this we have no problems, and I want to inspect the data so I want to see the first five rows of the data. So we're going to use a function called .head, and as you can see, if you're used…

Contents