Book Image

Python Social Media Analytics

By : Baihaqi Siregar, Siddhartha Chatterjee, Michal Krystyanczuk
Book Image

Python Social Media Analytics

By: Baihaqi Siregar, Siddhartha Chatterjee, Michal Krystyanczuk

Overview of this book

Social Media platforms such as Facebook, Twitter, Forums, Pinterest, and YouTube have become part of everyday life in a big way. However, these complex and noisy data streams pose a potent challenge to everyone when it comes to harnessing them properly and benefiting from them. This book will introduce you to the concept of social media analytics, and how you can leverage its capabilities to empower your business. Right from acquiring data from various social networking sources such as Twitter, Facebook, YouTube, Pinterest, and social forums, you will see how to clean data and make it ready for analytical operations using various Python APIs. This book explains how to structure the clean data obtained and store in MongoDB using PyMongo. You will also perform web scraping and visualize data using Scrappy and Beautifulsoup. Finally, you will be introduced to different techniques to perform analytics at scale for your social data on the cloud, using Python and Spark. By the end of this book, you will be able to utilize the power of Python to gain valuable insights from social media data and use them to enhance your business processes.
Table of Contents (17 chapters)
Title Page
Credits
About the Authors
Acknowledgments
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Working environment


The choice of the right tools is decisive for the smooth execution of the process. There are some important parts of the environment which facilitate data manipulation and algorithm implementation, but above all, they make the data science reproducible. We have selected the main components, which are widely used by data scientists all over the world, related to programming language, integrated development environment, and version control system.

Defining Python

Python is one of the most common programming languages among data scientists, along with R. The main advantage of Python is its flexibility and simplicity. It makes the data analysis and manipulation easy by offering a lot of packages. It shows great performance in analyzing unstructured textual data and has a very good ecosystem of tools and packages for this purpose.

For the purposes of the book, we have chosen Python 3.5.2. It is the most up-to-date version, which implements many improvements compared to Python 2.7. The main advantage in text analysis is an automatic management of Unicode variables. Python 2.7 is still widely used by programmers and data scientists due to a big choice of external libraries, documentation, and online resources. However, the new version has already reached a sufficient level of compatibility with packages, and on top of it, offers multiple new features.

We will use the pip command tool for installation of all libraries and dependencies.

Selecting an IDE

The choice of IDE (Integrated Development Environment) is mostly a matter of personal preferences. The most common choices are PyCharm, Sublime Text, or Atom. PyCharm is a very complete development environment while Sublime Text is a lightweight text editor which allows us to install additional plugins. Its main advantage is the fact that the user can choose the tools that he needs for his development. Atom is the newest software of all three, similar to Sublime Text. It was developed by GitHub and integrates by default the git version control system. In the book, we will use Sublime Text as the simplest and the easiest solution to start data analysis and development.

Illustrating Git

A version control system is one of the main elements of programming process. It helps to manage different versions of the code over time and reverse the changes in case of errors or wrong approach. The most widespread and easy-to-use version control system is Git and we will use it in our examples.