The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".
The following errata were submitted by our customers and approved as valid errors by the author or editor.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
|
Ch 5 - Getting Data-files with requests -
Look for the example from the government catalog |
The website mentioned in the example requires using a password, which has not yet been discussed in the book. To make this example work, try changing the following:
requests.get("https://cdph.data.ca.gov/api/views/6tej-5zx7/rows.json?accessType=DOWNLOAD")
to this:
requests.get("https://data.ct.gov/resource/y6p2-px98.json?category=Fruit&item=Peaches")
Note from the Author or Editor: Ch. 5, top p.133 (print edition). Change
response = requests.get(
"https://cdph.data.ca.gov/api/views/6tej-5zx7/rows.json
?accessType=DOWNLOAD")
to
response = requests.get(
"https://chhs.data.ca.gov/api/views/pbxw-hhq8/rows.json?accessType=DOWNLOAD")
|
Anonymous |
Sep 06, 2016 |
Mar 17, 2017 |
Other Digital Version |
chap1
"Python 2 or 3"? box |
"This is because Python 2+ works fine for many people, a lot of code will have to be converted1 and up until recently some of the big libraries, such as Numpy and Scipy, only worked for 3."
I think the author meant for the end of the sentence to be "...until recently some of the big libraries, such as Numpy and Scipy, only worked for 2."
|
Mitch |
Mar 17, 2016 |
Jun 29, 2016 |
Mobi |
Page Pos. 7392
2nd paragraph |
For me, the use of wikitable.prettify() causes and encoding error.
A google search helped me: Using wikitable.prettify().encoding('UTF-8') works.
|
Anonymous |
Apr 17, 2016 |
Jun 29, 2016 |
Mobi |
Chapter 1 - A Development Setup - The Accompanying Code |
Code is listed as available on this github site:
git clone https://github.com/Kyrand/dataviz-with-python-and-js.git
it isn't there or is not available.
Note from the Author or Editor: This is almost ready and will be released in the last week of June.
|
Carl |
May 25, 2016 |
Jun 29, 2016 |
Printed |
Page 3
Chapter 1 page 3 in "Checking the Anaconda Install" |
Chapter 1 page 3 in "Checking the Anaconda Install"
export PATH=/home/kyran/anaconda/bin:$PATH is specific to the 'kyran' user. Even if it's obvious and easy to fix, it could be confusing for new users.
It should have been more generic to indicate something like :
export PATH=/home/${USER}/anaconda/bin:$PATH which directly usable.
same thing for the Windows users, above in the same page.
Note from the Author or Editor: ch. 1, bottom p.3 (print ed.). Change
export PATH=/home/kyran/anaconda...
to
export PATH=/home/${USER}/anaconda...
|
Raoul Taddei |
Feb 10, 2017 |
Mar 17, 2017 |
PDF |
Page 17
Ch2 - JavaScript - the last command |
$sandpit python -m SimpleHTTPServer
should be changed
$ python -m SimpleHTTPServer
Note from the Author or Editor: Ch. 2, middle p17 (print edition). Change
Start your development server in the project directory
$sandpit python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
to
Start your development server in the project directory
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
|
yehnan |
Sep 25, 2016 |
Mar 17, 2017 |
Printed |
Page 25
last paragraph |
Minor typo, 'wit' instead of 'with'
"... the output string is constructed wit C type formatting."
should be
"... the output string is constructed with C type formatting."
Note from the Author or Editor: ch. 2, last para p.25:
change
"is constructed wit C"
to
"is constructed with C"
|
Anonymous |
Nov 05, 2016 |
Mar 17, 2017 |
PDF |
Page 29
Second line |
Here's the offending sentence:
------
Flask is Python’s most popular lightweight server and is perfect for creating a small, RESTful APIs which can be used by JavaScript to get data from the server,
in files or databases, to the browser.
------
I think the *a* should have been removed as its we're talking about APIS (plural)
|
rkda |
May 14, 2016 |
Jun 29, 2016 |
Mobi |
Page 34
Installing MongoDB, 2nd paragraph |
Hi :)
The link in the text 'For OS X users, check out this guide' currently leads to a placeholder Wordpress page with Chinese characters http://choskim.me/how-to-install-mongodb-on-apples-mac-os-x/
Note from the Author or Editor: Change the paragraph to:
For OSX users, check out the https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-os-x/[official docs] for MongoDB installation instructions.
|
Anonymous |
Jul 24, 2016 |
Mar 17, 2017 |
PDF |
Page 37
script.js |
// scripts.js
...
console.log('Sum= ' + sum);
// outputs 'Sum = 33'
RESULT: Sum= undefined (Why?)
// scripts.js
...
console.log('Sum= ' + total);
// outputs 'Sum = 33'
RESULT: Sum= 33
|
Anonymous |
Mar 21, 2016 |
Jun 29, 2016 |
PDF |
Page 43
Ch 2 - Difference in Practices - Enumerating a List - 1st paragraph |
"...very handy enumerate keyword..."
enumerate is a built-in function, not keyword.
Note from the Author or Editor: ch. 2, middle p.43 (print edition). Just under heading 'Enumerating a List' replace
"... very handy enumerate keyword... "
with
" ... very handy built-in enumerate function ... "
|
yehnan |
Sep 25, 2016 |
Mar 17, 2017 |
Mobi |
Page 43%
Example 3.3 |
In the chapter "Defining the database tables" Mr. Dale mentions to create a Base class using declarative_base.
I think the line Base = declarative_base() should be shown in the code example.
More important, to use declarative_base() one has to import it from the sqlalchemy module using
from sqlalchemy.ext.declarative import declarative_base
|
Anonymous |
Apr 16, 2016 |
Jun 29, 2016 |
PDF |
Page 48
ch2 - Functional Array Methods and List Comprehensions - 2nd code listing |
built-in range keyword
should changed to
built-in function range
Note from the Author or Editor: ch. 2, top p.48. Last bullet point. Change
"... built in range keyword.."
to
"... built in range function..."
|
yehnan |
Sep 25, 2016 |
Mar 17, 2017 |
PDF |
Page 62
ch 3 - Working with System Files - last code - comment 1 |
It says:
"Adding a comma to the end of the print statement inhibits the
addition of an unnecessary newline."
which means it uses Python 2's print statement.
However, in page 2's sidebar "Python 2 or 3?", the author says he will use Python 3's print function.
Note from the Author or Editor: ch. 3, top p62, bullet point (1) (print ed.). Change
" ... adding a comma to the end of the print statement ... "
to
"... adding a comma after the print function call inhibits ...
|
yehnan |
Sep 26, 2016 |
Mar 17, 2017 |
Printed |
Page 63
top code segment |
ch.3, p.63.
There are two code samples, the second starting with an 'import csv' line. This line should be placed at the top of the first code sample instead. i.e. change
...
with open('data/nobel_winners.csv...
...
import csv
with open('data/nobel_winners.csv...
to
...
import csv
with open('data/nobel_winners.csv...
...
with open('data/nobel_winners.csv...
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 68
top code block |
ch.3, p.68 top code block
The code block starting
In [0]: time_str = '2012...
should be changed to, in asciidoc:
[source, python]
----
In [0]: from datetime import datetime
In [1]: time_str = '2012/01/01 12:32:11'
In [2]: dt = datetime.strptime(time_str, '%Y/%m/%d %H:%M:%S') <1>
In [3]: dt
Out[2]: datetime.datetime(2012, 1, 1, 12, 32, 11)
----
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 77
second para |
A footnote needs to be ammended in the paragraph beginning
'One library I've found myself using...'
In asciidoc the following change is needed:
One library I've found myself using a fair deal recently is https://dataset.readthedocs.org/en/latest/[Dataset], a module designed to make working with SQL databases a little easier and more Pythonic than existing powerhouses like SQLAlchemyfootnote:[Dataset's official motto being `databases for lazy people'. Dataset is not part of the standard Anaconda package so you'll want to install it using pip from the command line: `$ pip install dataset'.]. Dataset tries to provide the same degree of convenience you get when working ...
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
PDF |
Page 79
Line 28 |
In the code, mongo database get functuion is called with the wrong name.
db = mongo_to_database(DB_NOBEL_PRIZE)
should be changed to:
db = get_mongo_database(DB_NOBEL_PRIZE)
Note from the Author or Editor: bottom of p. 81 (printed version):
db = mongo_to_database(DB_NOBEL_PRIZE)
should be changed to:
db = get_mongo_database(DB_NOBEL_PRIZE)
|
Anonymous |
Aug 02, 2016 |
Mar 17, 2017 |
Printed |
Page 82
middle note |
ch.3, p.82.
The code sample in the middle note needs to be changed from:
oid = bson.ObjectId()
oid.generation_time...
to
import bson
oid = bson.ObjectId()
oid.generation_time...
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 105
Second para and label of Example 4.1 |
ch.4, p.105
The second para needs extending:
We'll first need our HTML skeleton, using the code in <<skel_html>>. This consists of a tree of `<div>` content blocks, defining three chart-elements, a header, main and sidebar section. We'll save this file as +index.html+.
The title of Example 4.1 should now be, in asciidoc:
[[skel_html]]
.The file index.html, our HTML skeleton
====
[source,html]
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 106
Example 4-2 title |
ch.4, p.106, Ex 4-2 title
The title should be changed. In asciidoc:
[[skel_css]]
.The style.css fle, providing our CSS styling
====
[source,css]
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 107
third para from bottom of page |
ch.4, p.107, third para from bottom.
The paragraph should be updated thus (in asciidoc):
With our HTML and CSS defined we can examine the skeleton by firing up Python's single-line +SimpleHTTPServer+ in the project directory containing the +index.html+ and +style.css+ files defined in <<skel_html>> and <<skel_css>>, like so:
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Mobi |
Page 119
first line |
Here's the typo:
...covering the Python to Javscript dataviz converters.
|
rkda |
May 14, 2016 |
Jun 29, 2016 |
PDF |
Page 137
Line 23 |
In the code it is mentioned:
col.insert(country_data)
This will return an error as country_data is not defined. This should be corrected to:
col.insert(response.json())
Note from the Author or Editor: Ch. 5, bottom p. 139 (print edition):
Change
...
# Insert the JSON-objects straight to our collection
col.insert(country_data)
to
# Insert the JSON-objects straight to our collection
col.insert(response.json())
|
Anonymous |
Aug 04, 2016 |
Mar 17, 2017 |
Printed |
Page 144
last paragraph, code-block |
ch.5, p.144, code-block at bottom of page and preceding paragraph:
The reference to 'follower_ids()' should be 'followers_ids()':
.... The Tweepy method followers_ids (get...
then
[source, python]
----
my_follower_ids = api.followers_ids() <1>
for id in my_followers_ids:
followers = api.followers_ids(id) <2>
# ...
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
PDF |
Page 151
HTML place-holder for the SVG element |
The tag <svg id='char'> is not closed; should be <svg id='char'></svg>
Consequence of this typo:
Javascript script.js would not be executed, and not chart shown.
|
junkoda |
Jun 20, 2016 |
Jun 29, 2016 |
Printed |
Page 152
bottom code-block |
ch.5, p.152, bottom code-block:
Need to change
get_column_titles(wikitable)
to
get_column_titles(table)
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
PDF |
Page 155
ch 5 - Selecting Tags - Scraping the Winners’ Nationalities - first paragraph |
In the text of page 155, the function name is get_nationality:
"
A little get_nationality() function will use the winner links ...
"
In the code of page 156, the function name is get_winner_nationality.
Note from the Author or Editor: ch. 5, bottom p.155 (print ed.). Change
" ... A little get_nationality ... "
to
" ... little get_winner_nationality ... "
|
yehnan |
Oct 02, 2016 |
Mar 17, 2017 |
Printed |
Page 183
Example 6-5 |
ch. 6, p.183, Example 6-5. The code should be changed from
if href:
request = scrapy.Request('https:' + href[0],\
to
if href:
request = scrapy.Request(href[0],\
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 203
first code sample |
ch.7, p.202:
The code should be changed from
a = array([45, 65 ...
to
a = np.array([45, 65...
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 206
2nd para, 1st line of code |
line reading:
a = arange(10)
should be:
a = np.arange(10)
because numpy is imported as np
Note from the Author or Editor: ch. 7, following third para p.206 (printed ed.). Change
a = arange(10)
to
a = np.arange(10)
|
Stevemr |
Jan 15, 2017 |
Mar 17, 2017 |
Printed |
Page 210
Chapter The DataFrame |
On page 210, before pandas can be used to create the dataframe, it needs to be imported:
import pandas as pd
On page 211, for me to work the loc command needs be invoced with square brackets:
df.loc["Albert Einstein']
Note from the Author or Editor: ch. 8, p210 para 3 (print ed.).
Change
df = pd.read_json('data/nobel_winners.json')
to
import pandas as pd
df = pd.read_json('data/nobel_winners.json')
p. 211, below second para, bullet point (2). Change
In [3] df.loc('Albert Einstein')
to
ln[3] df.loc['Albert Einstein']
|
SteffenM |
Dec 04, 2016 |
Mar 17, 2017 |
PDF |
Page 214
ch 8 - The DataFrame - Selecting Groups - last paragraph |
it says:
"
For now, let’s take a quick look at Pandas Panel s, which are
containers for multiple DataFrame...
"
But the section of Panel is at the end of the chapter, not following the current section.
Note from the Author or Editor: ch.8, second para p.214 (print ed.). Change
... For now let's look take a quick look at Pandas Panels, which are containers for multiple data frames before moving on to see how we create data frames from existing data and how to save the results of our data frame manipulations.
to
For now let's see how we create DataFrames from existing data and how to save the results of our data frame manipulations.
|
yehnan |
Oct 05, 2016 |
Mar 17, 2017 |
Printed |
Page 214
Creating and Saving DataFrames |
The examples assume that pandas has been importet completely into the modules / consoles namespace.
Following the logic of the preceding expamples it should be
df = pd.DataFrame({...})
Note from the Author or Editor: ch. 8, p.214, (print ed.) section 'Creating and Saving DataFrames'. In code sections, change "df =DataFrame ... " to "df = pd.DataFrame":
df = DataFrame({ ---> df = pd.DataFrame({
...
df = DataFrame.from_dict... ---> df = pd.DataFrame.from_dict...
|
SteffenM |
Dec 04, 2016 |
Mar 17, 2017 |
Printed |
Page 218
Excel Files - second code section |
data = read_excel('nob...
should be:
data = pd.read_excel('nob...
because pandas was imported as pd
Note from the Author or Editor: ch. 8, Example 8.1 and following code sample, p.219 (printed ed.). Change refs on this page to 'read_excel' to 'pd.read_excel':
# return the first datasheet
df = read_excel('nobel_winn...'
to
df = pd.read_excel('nobel_winn...'
|
Stevemr |
Jan 16, 2017 |
Mar 17, 2017 |
Printed |
Page 219
Example: Save DataFrame to Excel |
If the file format for the to_excel method is not provided, I receive an error. The example needs to read
df.to_excel('nobel_winners.xls', sheet_name='WSheet1')
Note from the Author or Editor: ch. 8, p.219 just after third para from bottom (print ed.). Change
df.to_excel('nobel_winners' ...
to
df.to_excel('nobel_winners.xlsx', ...
|
SteffenM |
Dec 04, 2016 |
Mar 17, 2017 |
Printed |
Page 222
def mongo_to_dataframe |
In the example for mongo_to_dataframe, the name of the pandas DataFrame constructor needs to be written in CamelCase:
df = pd.DataFrame(list(cursor))
Note from the Author or Editor: ch.8, middle p.222 (print ed.). The code needs to be changed from
df = pd.dataframe(list(cursor..
to
df = pd.DataFrame(list(cursor...
|
SteffenM |
Dec 07, 2016 |
Mar 17, 2017 |
Printed |
Page 223
Examples |
In contrast to the examples before, these examples assume that the pandas module has been imported completely to the namespace.
To be in line with previous examples, they should read:
s = pd.Series([1,2,3,4])
etc.
Note from the Author or Editor: ch.8, p.223-4 (print ed.). The 'Series' calls in the code samples should be prefixed with a 'pd' for six changes in total (three on p.223, three on p.224):
s = Series([... ---> s = pd.Series([...
|
SteffenM |
Dec 05, 2016 |
Mar 17, 2017 |
Printed |
Page 226
2nd example |
The command to output the item1 dataframe from the panel should be
pn['item1'] instead of panel['item1']
Note from the Author or Editor: ch. 8, just after second para p.226 (print ed.). Change
panel['item1']
to
pn['item1']
|
SteffenM |
Dec 05, 2016 |
Mar 17, 2017 |
Printed |
Page 240
first line |
In the example to replace empty strings, the numpy module is used to access the NaN values with np.nan. However the relevant import statement is not shown.
import numpy as np
Note from the Author or Editor: ch.9, top p.240 (print ed.). Change
bi_col.replace('', np.nan...
to
import numpy as np
bi_col.replace('', np.nan...
|
SteffenM |
Dec 09, 2016 |
Mar 17, 2017 |
Printed |
Page 254
code block following first para |
ch.9, p.254, first code-block:
In asciidoc, need to add a comma and forward-slash before the second bullet point (<2>):
[source, python]
----
for i,row in df.iterrows():
try:
pd.to_datetime(row.date_of_death, errors='raise') <1>
except:
print '%s(%s, %d)'%(row.date_of_death.ljust(30),\ <2>
row['name'], i) <3>
----
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 286
following first para |
ch.10, p.286
The code sample following '... plots of tip size against total bill.' should be changed from
g = sns.FacetGrid(tips, col="sex")
to
g = sns.FacetGrid(tips, col="smoker")
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 287
middle code-sample |
ch.10, p.287
The code sample needs changing. Line 5 should be changed from
g.map(plt.regplot, "total_bill"...
to
g.map(sns.regplot, "total_bill"...
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
Printed |
Page 306
Following first para |
ch.11, pages 306-7
References to df_nat on this page and following page 307 should be replaced by df_countries and ref. to 'sort' replaced by 'sort_values':
df_countries = df_nat.set_index('name') -> df_countries = df_countries.set_index(...
change
df_nat.sort('nobel_per_capita'...
to
df.countries.sort_values(by='nobel_wins_per_capita', ascending=False)\
Top of page 307:
change
df_nat[df_nat.nobel_wins > 2]
.sort(...
to
df_countries[df_countries.nobel_wins > 2]\
.sort_values(by='nobel_wins_per_capita', ascending=False)\
.nobel_wins_per_capita.plot(kind='bar')
|
Kyran Dale |
Feb 21, 2017 |
Mar 17, 2017 |
PDF |
Page 332
Ch 12 - Serving the Data - Organizing Your Flask Files - Figure 12-1 |
In the content, it says "labeled a", "labeled b", and "labeled c".
But in the Figure 12-1, there are no "a", "b" and "c" labels.
Note from the Author or Editor: ch. 12, second para p.332 (printed ed.). Change
... from the basic dataviz JavaScript prototype using a one-line server labelled (a), through a more complex project labelled (b) to a typical, simple Flask setup labelled (c).
to
from the basic dataviz JavaScript prototype using a one-line server labelled basic, through a more complex project labelled basic+ to a typical, simple Flask setup labelled flask_project.
|
yehnan |
Oct 12, 2016 |
Mar 17, 2017 |
Mobi |
Page 1879
Last paragraph |
Chapter 3.
Working with System Files、last paragraph
…our CCSV file is …
=>
…our CSV file is
Note from the Author or Editor: Ch. 3, p. 62 (print ed.), last para of 'Working with System Files'. Change
... our CCSV...
to
... our CSV ...
|
kamimura |
Sep 08, 2016 |
Mar 17, 2017 |
Mobi |
Page 5215
last code |
Chapter 7. Array Indexing and Slicing
a = np.array(arange(8))
=>
a = np.arange(8)
Note from the Author or Editor: ch.7, middle p.202 (print ed.). Change
a = np.array(arange(8))
to
a = np.arange(8)
|
kamimura |
Dec 18, 2016 |
Mar 17, 2017 |