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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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
Estimated delivery fee Deliver to France

Premium delivery 7 - 10 business days

€10.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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
Estimated delivery fee Deliver to France

Premium delivery 7 - 10 business days

€10.95
(Includes tracking information)

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%
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

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela