Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Hands-On Data Science with Anaconda
Hands-On Data Science with Anaconda

Hands-On Data Science with Anaconda: Utilize the right mix of tools to create high-performance data science applications

Arrow left icon
Profile Icon Yuxing Yan Profile Icon Yan
Arrow right icon
Mex$447.98 Mex$639.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.6 (5 Ratings)
eBook May 2018 364 pages 1st Edition
eBook
Mex$447.98 Mex$639.99
Paperback
Mex$799.99
Subscription
Free Trial
Arrow left icon
Profile Icon Yuxing Yan Profile Icon Yan
Arrow right icon
Mex$447.98 Mex$639.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.6 (5 Ratings)
eBook May 2018 364 pages 1st Edition
eBook
Mex$447.98 Mex$639.99
Paperback
Mex$799.99
Subscription
Free Trial
eBook
Mex$447.98 Mex$639.99
Paperback
Mex$799.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Data Science with Anaconda

Anaconda Installation

In this chapter, we will discuss how to install Anaconda and use its various components, such as Python, IPython, Jupyter, and Spyder. In this book, we will not teach R, Python, Julia, or Octave. Thus, we assume that readers have some basic knowledge related to those programming languages, especially Python and R. There are many books available, such as Python for Finance by Yan (2017, 2nd edition) and Financial Modeling Using R by Yan (2016).

In this chapter, the following topics will be covered:

  • Installing Anaconda
  • Testing Python
  • Using IPython
  • Using Python via Jupyter
  • Introducing Spyder
  • Installing R via Conda
  • Installing Julia and linking it to Jupyter
  • Installing Octave and linking it to Jupyter
  • Finding help

Installing Anaconda

First, go to http://anaconda.org/. We can see Download Anaconda the top-right part of the page. Based on the individual operating system, users should download the appropriate package.

Depending on which version you prefer, you could download Python 3.6 or Python 2.7. Generally speaking, for new learners it is a good idea to download the latest version (Python 3.6 in this case). This applies for both Mac and Linux-based operating systems.

Anaconda for Windows

Refer to the following steps:

  1. For PC users, after clicking on Windows, you will be presented with different versions to download.

As of May 09, 2018, two versions of Python accompanying Anaconda, version 3.6 and version 2.7, are available If there...

Testing Python

The steps for testing Python are as follows:

  1. For PC users, after clicking All Programs, Anaconda3.6, and then Anaconda Prompt, we would see the following.

Note that different users would probably get a different path:

  1. Then, just type python, and we can launch it, as shown here:
  1. It tells us that Python 3.6.3 was operational. We could also try import scipy as sp to see if it is preinstalled:
  1. After we type import scipy as sp, no error message appears, which indicates that the package was preinstalled. The command of sp.sqrt(3) would offer us the square root of 3. Another example with the related graph is shown here:
import scipy as np 
from pylab import * 
x=np.linspace(-np.pi,np.pi,256,endpoint=True) 
c,s=np.cos(x),np.sin(x) 
plot(x,c),plot(x,s) 
show()  

The previous code will give an output such as the following:

...

Using IPython

For a Windows version, after navigating to Anaconda3 from All Programs and then clicking on IPython, we can see the following:

You can also do the the same by launching Anaconda Prompt and then typing ipython.

This tells us that the version of Python is 3.6.3 and that the version of IPython is 6.1.0. We could type a few commands to test it. For example, if we invest $100 today for an investment horizon of 5 years, and the annual return is 10%, what is our expected future value? The future value formula for a given present value is provided here:

where FV is the future value, PV is the present value, R is the period return, and n is the number of periods:

The first line of command of pv=100 assigns a value of 100 to pv. For the fifth line, we typed a command line of pv*(1+r)^n. However, we received an error message of TypeError: unsupported operand type(s) for...

Using Python via Jupyter

Here, we show you how to write simple Python code via Jupyter:

  1. From the menu, after clicking Anaconda, we can find an entry called Jupyter Notebook. After clicking on that entry, we can see the following:
  1. If we click New on the right-hand side, we can find several choices. After we choose Python 3, we end up with the following starting file:
  1. We can now type our Python commands in the box. Remember to press Shift + Enter if you want to execute the command (shown here):
  1. We can also type multiple commands and execute them, as shown here:

The colorful and distinct treatment of keywords, parentheses, and values makes our programming a little easier.

We could save our programs by choosing File|Save and Checkpoint on the menu bar. Similarly, we could load our presaved programs by choosing File|Revert to Checkpoint directly from the menu bar or finding...

Introducing Spyder

In the Anaconda3 menu, the last entry is Spyder. After clicking it, we can launch Spyder, shown here:

The preceding screenshot shows three panels. The left panel is for writing and editing our programs, the bottom-right panel is for command lines (we could type simple commands there), and the top-right panel is for our variables. For example, after we type pv=100, it would show the variable name, type, size, and value, as shown here:

We could also write our Python program, and debug and run them via the top-left panel. For example, we could run a program with pv_f() function to estimate the present value of one future cash flow, shown here:

In the preceding screenshot, the green play button is for running the whole Python program, while the second green-yellow one is for partially running it. This feature makes our debugging efforts a little easier, which...

Installing R via Conda

The following steps are for R package installation:

  1. Note that the R package is not preinstalled when installing Anaconda, as shown here:
  1. To install R software, we have to issue the following command after we click Anaconda Prompt:
conda install r-essentials
  1. After installation, we can see the following:
  1. We could try a few commands. For example, we first generate an R function called pv_f() with the keyword function. For this function, we have three input values: fv for future value, r for interest rate, and n for the number of periods:

Installing Julia and linking it to Jupyter

The steps for installing Julia are as follows:

  1. First, we go to the following web page to download Julia: https://julialang.org/downloads/.
  2. As when downloading Anaconda, we have different versions depending on our system, as shown here:
  1. Again, based on your operating system (Windows, Mac, or Linux), choose the appropriate version and download the executable package.

  1. Clicking the executable, we can install the package and, in order to launch Julia, we simply click on Julia.exe.
  2. In it, we can type println("Hello World"), as shown:

Alternatively, for Windows, we can click All Programs | Julia. We can also copy and paste Julia to our desktop.

  1. In addition, another way to launch Julia is through a DOS window. However, before we can do so, we have to add the path to the directory that contains Julia.exe to our path. For example...

Installing Octave and linking it to Jupyter

Follow these steps to install Octave:

  1. To install the Octavekernel linked to Anaconda, at Anaconda Prompt, we log in by issuing the Anaconda login command. Note that in order to log in, users have to register first at https://anaconda.org. After logging in to Anaconda, we could issue the following command:
pip install octave_kernel
  1. After we launch Jupyter and click New on the right-hand side, we can see Octave, among other languages:
  1. Now we can test a simple program in Octave:
x=-9:0.1:9; 
y=sin(x); 
plot(x,y) 
  1. The related output is shown here:

Finding help

  1. In Chapter 1, Ecosystem of Anaconda, we showed that we could go to the link https://docs.anaconda.com/anaconda/user-guide/.
  2. After clicking the link, we would see four entries, shown here:
  1. We could type conda help to find information about the usages of Conda. In Windows, click All Programs | Anaconda | Anaconda Prompt. In the Prompt, type conda help, as shown here:
  1. To find all packages associated with a Conda environment, we could issue the conda list command.
  2. Since the number of packages is quite large, a better solution is to generate a text file. We could issue conda list >c:/temp/list.txt:
  1. The first several lines from the output file called list.txt are shown:
  1. We could write an R program to read this text file:
> x<-read.csv('c:/temp/list.txt',skip=2) 
> head(x) 
X_ipyw_jlab_nb_ext_conf....0.1.0............py36ha9200a3_0 
1...

Summary

In this chapter, we showed you how to install Anaconda and test if the installation was successful. We looked at how to launch Jupyter and how to use it to launch Python, how to launch Spyder and R, and how to find help. Most of these concepts or procedures are quite basic, so users who are quite confident with them can skip this chapter and go to Chapter 3, Data Basics, directly.

In Chapter 3, Data Basics, we first discuss open data sources such as the UCI (University of California at Irvin) machine learning depository and the bureau of labor statistics. Then, we introduce the Python Pandas package. Many issues, such as how to deal with missing data, sorting, how to slice and dice datasets, merging different datasets, and data input and output, will be discussed in detail. Several relevant packages for data manipulation will be also introduced and discussed.

...

Review questions and exercises

  1. What is Anaconda? How do we use its platform?
  2. What is the home page for Anaconda?
  3. How do we install Anaconda?
  4. After Anaconda is installed, should we install Python separately? What about R?
  5. What is Jupyter? How do we launch it?
  6. How do we launch Python from Jupyter?
  7. How do we use Python via Jupyter?
  8. What is Spyder and how do we launch it?
  9. Write a Python program to estimate the present value of the annuity, as shown in the following formula:

pv(annuity) is the present value of the annuity, C is the periodic payment, R is the discount rate, and n is the number of periods.

  1. Find out how many packages are available after you have installed Anaconda. (Hint: check the link at https://docs.anaconda.com/anaconda/packages/pkg-docs.)
  2. What are the advantages and disadvantages of using https://jupyter.org/try?
  3. Where can new users find more information about...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • -Use Anaconda to find solutions for clustering, classification, and linear regression
  • -Analyze your data efficiently with the most powerful data science stack
  • -Use the Anaconda cloud to store, share, and discover projects and libraries

Description

Anaconda is an open source platform that brings together the best tools for data science professionals with more than 100 popular packages supporting Python, Scala, and R languages. Hands-On Data Science with Anaconda gets you started with Anaconda and demonstrates how you can use it to perform data science operations in the real world. The book begins with setting up the environment for Anaconda platform in order to make it accessible for tools and frameworks such as Jupyter, pandas, matplotlib, Python, R, Julia, and more. You’ll walk through package manager Conda, through which you can automatically manage all packages including cross-language dependencies, and work across Linux, macOS, and Windows. You’ll explore all the essentials of data science and linear algebra to perform data science tasks using packages such as SciPy, contrastive, scikit-learn, Rattle, and Rmixmod. Once you’re accustomed to all this, you’ll start with operations in data science such as cleaning, sorting, and data classification. You’ll move on to learning how to perform tasks such as clustering, regression, prediction, and building machine learning models and optimizing them. In addition to this, you’ll learn how to visualize data using the packages available for Julia, Python, and R.

Who is this book for?

Hands-On Data Science with Anaconda is for you if you are a developer who is looking for the best tools in the market to perform data science. It’s also ideal for data analysts and data science professionals who want to improve the efficiency of their data science applications by using the best libraries in multiple languages. Basic programming knowledge with R or Python and introductory knowledge of linear algebra is expected.

What you will learn

  • •Perform cleaning, sorting, classification, clustering, regression, and dataset modeling using Anaconda
  • •Use the package manager conda and discover, install, and use functionally efficient and scalable packages
  • •Get comfortable with heterogeneous data exploration using multiple languages within a project
  • •Perform distributed computing and use Anaconda Accelerate to optimize computational powers
  • •Discover and share packages, notebooks, and environments, and use shared project drives on Anaconda Cloud
  • •Tackle advanced data prediction problems

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 31, 2018
Length: 364 pages
Edition : 1st
Language : English
ISBN-13 : 9781788834735
Vendor :
Anaconda
Category :
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : May 31, 2018
Length: 364 pages
Edition : 1st
Language : English
ISBN-13 : 9781788834735
Vendor :
Anaconda
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 2,051.97
Beginning Data Science with Python and Jupyter
Mex$348.99
Hands-On Data Science with Anaconda
Mex$799.99
Jupyter Cookbook
Mex$902.99
Total Mex$ 2,051.97 Stars icon

Table of Contents

14 Chapters
Ecosystem of Anaconda Chevron down icon Chevron up icon
Anaconda Installation Chevron down icon Chevron up icon
Data Basics Chevron down icon Chevron up icon
Data Visualization Chevron down icon Chevron up icon
Statistical Modeling in Anaconda Chevron down icon Chevron up icon
Managing Packages Chevron down icon Chevron up icon
Optimization in Anaconda Chevron down icon Chevron up icon
Unsupervised Learning in Anaconda Chevron down icon Chevron up icon
Supervised Learning in Anaconda Chevron down icon Chevron up icon
Predictive Data Analytics – Modeling and Validation Chevron down icon Chevron up icon
Anaconda Cloud Chevron down icon Chevron up icon
Distributed Computing, Parallel Computing, and HPCC Chevron down icon Chevron up icon
References Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.6
(5 Ratings)
5 star 20%
4 star 20%
3 star 0%
2 star 20%
1 star 40%
Sinjin Dec 14, 2021
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This book had potential but wasted it by spreading itself too thin. The biggest problem is that it covers Python, R, Julia, and Octave. This may sound like a good idea, but it doesn't really work. If you plan to use mainly Python or R, then all the repeated sections really get in the way. Further, the book is fairly thin for such a large subject, and if you take away all the redundant sections, you're left with barely anything. It comes across as an expedient exercise to cash in on the surge in data science popularity by just cobbling together some screen shots and example plotting commands and by lurching from one subject to another with little exposition. A better use of your money would be to buy books dedicated to Python, R, etc. Also, check their table of contents to be sure they have a logical structure that covers important topics in detail.
Amazon Verified review Amazon
zoom Aug 20, 2021
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This book is extremely superficial. Nothing goes even a little bit in depth. A bit of googling is a better use of time and you do not need to pay for that either. I returned my copy.
Amazon Verified review Amazon
rivertech Apr 25, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is about the tools that are available through Anaconda that are useful for performing data science - it is not about how to do data science.
Amazon Verified review Amazon
ABHIJIT Feb 28, 2019
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
It's fairly ok book . but not very lucid in explanation.
Amazon Verified review Amazon
ERDINC ATILGAN Jan 01, 2019
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This book absolutely does not worth its price. Very little useful information regarding Data Science. Very superficial. It is basically a collection of many many screenshot pictures of someone working on various data science jumping from one subject to another. I learned very little from this book. Does not worth its cost.... Waste of money....
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.