Skip to Main Content
Data Science Using Python and R
book

Data Science Using Python and R

by Chantal D. Larose, Daniel T. Larose
April 2019
Beginner to intermediate content levelBeginner to intermediate
240 pages
6h 47m
English
Wiley
Content preview from Data Science Using Python and R

Chapter 2THE BASICS OF PYTHON AND R

2.1 DOWNLOADING PYTHON

To run Python code, you need to use a Python compiler. In this text, we will be using the Spyder compiler, which is included in the Anaconda software package. By downloading and installing Anaconda, we will also download and install Python at the same time.

To download Anaconda, go to the Spyder installation page1 and select the Anaconda link under either the Windows or MacOS X options. After the installation is complete, locate the Spyder program and open it.

When you open Spyder for the first time, you will see the screen shown in Figure 2.1. The left‐hand box is where you will write Python code. That box is where we will spend most of our time. The top‐right box lists data sets and other items that have been created by running Python code. The bottom‐right box is where our output will appear, as well as any error messages or other information.

Image described by caption and surrounding text.

Figure 2.1 The Spyder window when you first open the program.

2.2 BASICS OF CODING IN PYTHON

In Python, as in most other programming languages, you run code which performs an action. Some actions also generate output. There are five kinds of actions we will focus on in this chapter: Using comments, Importing packages, Executing commands, Saving output, and Getting data into Python.

2.2.1 Using Comments in Python

Comments are pieces of code that are not executed by the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Data Science with Python 3: Synthesizing Actionable Insights from Data

Practical Data Science with Python 3: Synthesizing Actionable Insights from Data

Ervin Varga
Python Data Science Essentials - Third Edition

Python Data Science Essentials - Third Edition

Alberto Boschetti, Luca Massaron, Pietro Marinelli, Matteo Malosetti

Publisher Resources

ISBN: 9781119526810Purchase book