Monday, July 1, 2019

IslandT: Starting a web analytics project with Pandas

  1. Start a new web analytics project with python using PyCharm IDE
  2. Install Pandas
  3. Load the csv file

Hey dude, how is it going? As I had promised you all in my previous post that I will start a new project, well, here we go! This project will take a few weeks to complete and the main reason I have created this project is to demonstrate to you all what can a developer achieve with the Pandas module.

Before we start to write python code please make sure you have installed the latest version of PyCharm because we are going to use PyCharm IDE to develop this project.

Once you have the PyCharm installed on your computer, go to File->New Project and create a new Python project from there onward. I assume you are already familiar with PyCharm IDE so I will not go into detail on how to create a new Python project. After you have created a new project, you need to create a Python file under the project folder, again, I assume you have already known that!

Then just go ahead and install the Pandas module with PyCharm through the below steps : File->Settings->Project:yournewproject/Project Interpretor, under the right part of the box, click on the plus sign, then enter “Pandas” in the pop-up search box and then install the pandas package.

Install new python module
Searching for Pandas on PyCharm

In this project I will use the data from Google Analytic to analysis the ranking of my website on the Google SERP, I have downloaded the first copy of the analytic data in the form of csv file. The csv file has been copied to the same folder as the python file in this project.

The project folder structure

Now, we will use Pandas to load the csv data, from the top (10 positions) to the end.

import pandas as pd

analytic = pd.read_csv('analytic.csv')

print(analytic.tail(10))
The keyword ranking of this website

As you can see, my website is doing terrible at the moment, none of the keywords are actually rank well. But again I just want to point it out, I just want to use Pandas to do some analysis on my site data, I don’t think this site will do well even after the analysis! For the last 10 years, my websites seldom do well on both Google or Bing. Will I ever receive ‘LOVE’ from Google or Bing?

Stay tuned! We will create a full applicable application using this Pandas module!



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...