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

eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781788831192
Vendor :
Anaconda
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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 €5 each
Feature tick icon Exclusive print discounts
€264.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 €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 75.97
Beginning Data Science with Python and Jupyter
€12.99
Hands-On Data Science with Anaconda
€29.99
Jupyter Cookbook
€32.99
Total 75.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%
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
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
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
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
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.