Book Image

Practical Data Science Cookbook, Second Edition - Second Edition

By : Prabhanjan Narayanachar Tattar, Bhushan Purushottam Joshi, Sean Patrick Murphy, ABHIJIT DASGUPTA, Anthony Ojeda
Book Image

Practical Data Science Cookbook, Second Edition - Second Edition

By: Prabhanjan Narayanachar Tattar, Bhushan Purushottam Joshi, Sean Patrick Murphy, ABHIJIT DASGUPTA, Anthony Ojeda

Overview of this book

As increasing amounts of data are generated each year, the need to analyze and create value out of it is more important than ever. Companies that know what to do with their data and how to do it well will have a competitive advantage over companies that don’t. Because of this, there will be an increasing demand for people that possess both the analytical and technical abilities to extract valuable insights from data and create valuable solutions that put those insights to use. Starting with the basics, this book covers how to set up your numerical programming environment, introduces you to the data science pipeline, and guides you through several data projects in a step-by-step format. By sequentially working through the steps in each chapter, you will quickly familiarize yourself with the process and learn how to apply it to a variety of situations with examples using the two most popular programming languages for data analysis—R and Python.
Table of Contents (17 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface

The ts object


The core R package datasets contains lot of datasets that are essentially time series data: AirPassengers, BJsales, EuStockMarkets, JohnsonJohnson, LakeHuron, Nile, UKgas, UKDriverDeaths, UKLungDeaths, USAccDeaths, WWWusage, airmiles, austres, co2, discoveries, lynx, nhtemp, nottem, presidents, treering, gas, uspop, and sunspots. The AirPassengers data is one of the most popular datasets and it is used as a benchmark dataset. The data can be loaded in an R session with data(mydata) and its class can be verified as time series as follows:


data
(JohnsonJohnson)


class
(JohnsonJohnson)


## [1] "ts"

JohnsonJohnson

## Qtr1 Qtr2 Qtr3 Qtr4

## 1960 0.71 0.63 0.85 0.44

## 1961 0.61 0.69 0.92 0.55

## 1962 0.72 0.77 0.92 0.60

## 1978 11.88 12.06 12.15 8.91


## 1979 14.04 12.96 14.85 9.99


## 1980 16.20 14.67 16.02 11.61


frequency
(JohnsonJohnson)

## [1] 4

The JohnsonJohnson dataset is a time series dataset and it is verified by applying the class function. Details about...