Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Become a Python Data Analyst
Become a Python Data Analyst

Become a Python Data Analyst: Perform exploratory data analysis and gain insight into scientific computing using Python

Arrow left icon
Profile Icon Alvaro Fuentes
Arrow right icon
Mex$297.99 Mex$426.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (510 Ratings)
eBook Aug 2018 178 pages 1st Edition
eBook
Mex$297.99 Mex$426.99
Paperback
Mex$533.99
Subscription
Free Trial
Arrow left icon
Profile Icon Alvaro Fuentes
Arrow right icon
Mex$297.99 Mex$426.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (510 Ratings)
eBook Aug 2018 178 pages 1st Edition
eBook
Mex$297.99 Mex$426.99
Paperback
Mex$533.99
Subscription
Free Trial
eBook
Mex$297.99 Mex$426.99
Paperback
Mex$533.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

Become a Python Data Analyst

The Anaconda Distribution and Jupyter Notebook

In this book, you will learn the basic concepts of data analysis using Python. In the first chapter, we will learn how to install the Anaconda distribution, which contains all the software needed for this book. We will also get to know Jupyter Notebook, which is the computing environment where we will do all of our work. Something nice about this book is that we take a hands-on practical approach that will help you to master the tools very effectively.

The following are the main topics that will be covered in this chapter:

  • The Anaconda distribution and the problems it solve
  • How to install it in our computer and get ready to start working
  • Jupyter Notebook, where we will perform our computations and analysis
  • Some useful commands and keyboard shortcuts used in Jupyter Notebook

The Anaconda distribution

Anaconda is a free, easy-to-install package management and environment management Python distribution created for developers and data scientists to make package management and deployment in scientific computing, data science, statistical analysis, and machine learning an easy task. It is software that is produced and distributed by Continuum Analytics and is available for free download at https://www.anaconda.com/download/.

Anaconda is a toolbox, a ready-to-use collection of related tools for doing data analytics with Python. The individual tools are also available for free download, but it is definitely more convenient to get the whole toolbox. This is the main problem that Anaconda solves, saving you the time it takes to look for every individual tool and install them on your system. In addition, Anaconda also takes care of package dependencies and other potential conflicts and problems that are the outcome of installing Python packages individually.

Installing Anaconda

On opening the previously mentioned URL, we are given download options for each operating system. So, here, you must look for the appropriate installer for your operating system. You will see two installers: one is for Python 3.6 and the other is for Python 2.7. In this book, we will be using Python 3.6:

Let's download the latest version of the Anaconda software and save in our Downloads folder.

Here, we choose the 64-bit installer of Anaconda 5.2 for Windows, since we will be working on a Windows environment in this book. Installation for macOS and Linux will also be similar.

Installing Anaconda is very simple; it is no different from any other software you have installed before. Double-click on the .exe file and install the software on your system. The steps are easy and you'll get the normal prompts you see when installing software:

  1. Click on Next in the first installer dialog box.
  2. Then, we have the license agreement, where we can click on I Agree after going through the terms and conditions of the software.
  3. From the options, select Just Me and click Next.
  4. Select the default installation destination folder and click Next.
  5. Next, it asks you for the environment variables and whether you want to register Anaconda as your default Python. Check both boxes and click on Install.
  6. Once the installation is complete, click on Finish in the installer dialog box.

Jupyter Notebook

Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations, and explanatory text. It is the application we will be working with in this book. Its uses include data cleaning and transformation, numerical simulation, statistical modeling, machine learning, and much more. Jupyter Notebook is similar to a canvas, or an environment, that allows you to use a programming language, in our case Python, to perform computations and to show the results in a very convenient way.

It is very convenient if you're doing some kind of analytical work, because often you want to include explanatory text, the code that produced the results, and the visualizations, which are shown in Jupyter Notebook. So it is a very convenient way of doing analytical work with any programming language, especially with Python. The Jupyter project was born out of the IPython project in 2014. Now, it has evolved to support interactive data science and scientific computing across many other programming languages, so you can use the Jupyter Notebook with many other programming languages (up to almost 20 languages). The name Jupyter comes from Julia, Python, and R, which were the three programming languages that were first supported.

Creating your own Jupyter Notebook

To start Anaconda and open a Jupyter Notebook, we click Anaconda Prompt from our list of installed programs. Anaconda Prompt is a Terminal where you can type commands. But first, let's create a folder called PythonDataScience on our desktop. This will be the directory where all the Python code that we code and run for this book in Jupyter Notebook will be stored.

Once the Terminal is open, navigate to PythonDataScience by typing the command cd Desktop/PythonDataScience and pressing Enter. To start the Jupyter Notebook application inside this directory, type the command jupyter notebook and hit Enter. This will start the application and you will see the main screen of the application opened in a tab on your browser:

You have three tabs here. One is the Files tab, where you will see all the files that you have inside the folder where you started the application. On the Running tab, you will see the things that you have running, either Terminals or Notebooks. The Clusters tab displays details about parallel computing, but we will not be using this feature in this book.

The main tab that we will be using in this book is the Files tab. To create a new Jupyter Notebook, go to New|Python 3 Notebook:

This will start a new file, which is the Jupyter Notebook where you can start coding and running your Python code.

Notebook user interfaces

Jupyter Notebook has some very useful user interfaces that display important information and notifications while you work on the Notebook. Let's go to Help and click on the first option, User Interface Tour, to take a quick look and get familiar with the interfaces of Jupyter Notebook:

The following are the main interfaces you will find on the main page of the Notebook:

  • Title (1): This is your filename and you can also change the filename of your Notebook.
  • Menu bar (2): Similar to any other desktop application, you have a menu bar where you can find different actions to do with the Notebook.
  • Toolbar (3): This is located below the menu bar and contains little icons to perform some commonly performed actions, such as saving a file, cutting cells, pasting cells, moving cells, and so on.
  • Mode indicator (4): This is located on the right-hand side of the menu bar. The Notebook has two modes, Edit mode and Command mode. Command mode has many keyboard shortcuts that you can use. In this mode, no icon is displayed in the indicator area, and the actions you can perform in this mode are actions that have to do with the file itself, such as saving the file, copying and pasting cells, and so on. Edit mode allows you to write code or text in a cell, if you are in a cell. When you are in Edit mode, you will see a little pencil in the indicator area.
A Jupyter Notebook is composed of two types of cells, code cells and text cells. The border of a selected cell will be green when you are in Edit mode. To go back to Command mode from Edit mode, you can press the Esc key or Ctrl + M. There are many keyboard shortcuts that you can use and there is a list in the Help menu.
  • Kernel indicator (5): This displays the status of the system's computation progress. To interrupt the computations that are in progress, you can use the stop button located on the toolbar.
  • Notification area (6): This area will display messages such as saving the file, or interrupting the kernel, and so on, and you will see the actions that you're performing in the notification area.

Using the Jupyter Notebook

Lets open a new Jupyter Notebook and create a new Python 3 Notebook, then name the Notebook as FirstPractice. As mentioned earlier, the Notebook is made out of cells, and you have two types of cells: the default cell type, which is called the code cell, and the other type of cells are text cells. We have a code cell every time we open a Notebook where you can execute any Python statement.

Running code in a code cell

We will run a few simple code statements and learn how to run those statements, and also learn how to change a cell type from code to text and vice versa. Let's execute the first code by typing 1 + 1 in the first code cell, and if you run the code of the cell with the run cell button, you will see the following output in the line below the code cell:

Next, let's create a variable, a, assign its value as 10, and run the code. Now this variable has been created, but since we didn’t create any code to compute the variable, we won’t see any output. But the statement was run, and now, if you use this variable, add 1 to it, and run the code, you will see the following result:

Now, let's see an example of the for syntax using a variable, i:

The code will tell the Notebook to print the value of i if and when the value is within the range of 10, which gives the preceding result.

Running markdown syntax in a text cell

As mentioned, the default type of each cell is a code cell, where we write Python expressions. The other type of cell that we have is a text cell, and a text cell is used to actually write text. In the cell below the output, let's type This is regular text. To tell the Notebook that this is not Python code and this is actually some text, you go to Cell | Cell Type | Markdown. Let’s run this now and you will find that what you get as output is just the text, the same text we entered:

Jupyter also allows us to format the text in many ways by using markdown syntax. If you are not familiar with markdown, you can go to Help|Markdown, where you will be taken to one of the GitHub help pages.

The markdown that you can use in Jupyter is the same markdown you use in GitHub.

There are many ways you can style and format your text; you can find all the information at: https://help.github.com/articles/basic-writing-and-formatting-syntax/. For this chapter, we will just look at the headings that are very important.

To create a heading, we add one to six # symbols before the heading text. The number of # symbols determines the size of the heading, starting from one to six # symbols, the largest to smallest heading, as follows:

# The largest heading
## The second largest heading
###### The smallest heading

The following screenshot shows the output for the preceding syntax:

If you run them in a code cell, you will get a bunch of Python commands, but we know that we want to see these as formatted text, so we need to tell the Notebook that these are actually texts by marking the cell type as markdown, and when you run the cell you get the preceding result.

Styles and formats

You can introduce other formats, such as bold, italic, strikethrough, and bold and italic. The following table shows the different styles and their corresponding syntax with an example of each:

You can also introduce quotes, for which the syntax is denoted by, the > symbol. Run a markdown cell with the following syntax:

In the words of Abraham Lincoln:
> Pardon my French

This will give the following result:

We find the style and format of the texts remains the same, similar to the line of text preceding the >, but the quoted text is a little indented from the normal indentation.

Lists

You can use or * before one or more lines to create a bulleted list. You can also use 1, 2, 3, and so on, to create a numbered or ordered list:

- George Washington
- John Adams
- Thomas Jefferson

1. James Madison
2. James Monroe
3. John Quincy Adams

On running the markdown syntax, we get the following result:

You will get a lot more styling and formatting syntax from a website that you can use in the Notebook.

Useful keyboard shortcuts

It is very annoying to use the mouse every time you want to run the cell or to transform a code cell into a markdown cell. To ease these tasks, we have a lot of keyboard shortcuts that you can use in Jupyter. Let's look at some of the most important ones.

To run a cell, for example, if you want to run the computation of 1 + 2, you can hit Alt + Enter. This shortcut will run the code in the cell and create a new cell below the output line. But if you just want to run the computation, you will press Ctrl + Enter; this will get the Notebook to run the code in that cell and show you the output, but no new cell will be created. If you want to insert a new cell below the current cell, you can press B, and then pressing A will create new cells above the current cell. This is very useful when you're working interactively within the Notebook and you want to create many cells to have more room to work.

If you find yourself using a command very often and you want to learn the shortcut key; you can go to Help|Keyboard Shortcuts. You will see a list of all the keyboard shortcuts that you can use in the Notebook.

Another very useful thing is how to transform cells from code cells to markdown cells. If you want to transform a code cell into a text cell, press the M key; this will get you from Edit mode to Command mode. Also, if you are in Command mode and you want to transform the cell into a code cell or Edit mode, press the Esc key.

Summary

In this chapter, we learned about the Anaconda distribution. We also installed all the software that we will use in the course, which is contained in the Anaconda distribution, and we learned about Jupyter Notebook and the basics of working with Jupyter Notebooks; about the code cells, the markdown cells, and the most useful keyboard command shortcuts to work with Jupyter and make our workflow more efficient.

In the next chapter, we will learn about NumPy, which is the core library for doing numerical computing and is at the core of every scientific computing project in the PythonX system.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Cover all fundamental libraries for operation and manipulation of Python for data analysis
  • Implement real-world datasets to perform predictive analytics with Python
  • Access modern data analysis techniques and detailed code with scikit-learn and SciPy

Description

Python is one of the most common and popular languages preferred by leading data analysts and statisticians for working with massive datasets and complex data visualizations. Become a Python Data Analyst introduces Python’s most essential tools and libraries necessary to work with the data analysis process, right from preparing data to performing simple statistical analyses and creating meaningful data visualizations. In this book, we will cover Python libraries such as NumPy, pandas, matplotlib, seaborn, SciPy, and scikit-learn, and apply them in practical data analysis and statistics examples. As you make your way through the chapters, you will learn to efficiently use the Jupyter Notebook to operate and manipulate data using NumPy and the pandas library. In the concluding chapters, you will gain experience in building simple predictive models and carrying out statistical computation and analysis using rich Python tools and proven data analysis techniques. By the end of this book, you will have hands-on experience performing data analysis with Python.

Who is this book for?

Become a Python Data Analyst is for entry-level data analysts, data engineers, and BI professionals who want to make complete use of Python tools for performing efficient data analysis. Prior knowledge of Python programming is necessary to understand the concepts covered in this book

What you will learn

  • Explore important Python libraries and learn to install Anaconda distribution
  • Understand the basics of NumPy
  • Produce informative and useful visualizations for analyzing data
  • Perform common statistical calculations
  • Build predictive models and understand the principles of predictive analytics

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 31, 2018
Length: 178 pages
Edition : 1st
Language : English
ISBN-13 : 9781789534405
Category :
Languages :
Concepts :

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 : Aug 31, 2018
Length: 178 pages
Edition : 1st
Language : English
ISBN-13 : 9781789534405
Category :
Languages :
Concepts :

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,113.97
Data Analysis with Python
Mex$902.99
Become a Python Data Analyst
Mex$533.99
Hands-On Data Analysis with NumPy and pandas
Mex$676.99
Total Mex$ 2,113.97 Stars icon

Table of Contents

7 Chapters
The Anaconda Distribution and Jupyter Notebook Chevron down icon Chevron up icon
Vectorizing Operations with NumPy Chevron down icon Chevron up icon
Pandas - Everyone's Favorite Data Analysis Library Chevron down icon Chevron up icon
Visualization and Exploratory Data Analysis Chevron down icon Chevron up icon
Statistical Computing with Python Chevron down icon Chevron up icon
Introduction to Predictive Analytics Models Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(510 Ratings)
5 star 51%
4 star 35.3%
3 star 11%
2 star 1.4%
1 star 1.4%
Filter icon Filter
Top Reviews

Filter reviews by




Amazon Customer Jan 19, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book to get started in Python Data manipulation. They build up the why on Series and Dataframes in a couple of pages. It's very clear and easy to read for a beginner.
Amazon Verified review Amazon
Anonymized User Aug 15, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Udemy Verified review Udemy
Joao Paulo Aragao Pereira Aug 13, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Udemy Verified review Udemy
Nissy Mary Joseph May 18, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Udemy Verified review Udemy
Selina Ma May 17, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Udemy Verified review Udemy
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.