Data Visualization with Python and JavaScript

Errata for Data Visualization with Python and JavaScript

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
chap 1, Anaconda section, python version info box

Since the time of publication, the following package has become compatible with Python 3. I think the book's contents need to be updated or at least somehow reflect this.

From Scrapy official website:
Scrapy is supported under Python 2.7 and Python 3.3+. Python 2.6 support was dropped starting at Scrapy 0.20. Python 3 support was added in Scrapy 1.1.

Anonymous  Oct 02, 2017 
Printed Page 17

Apparently SimpleHTTPServer has been replaced by http.server in Python 3.

Mike Sweeney  Mar 11, 2018 
Printed Page 20
Bullet list, 2nd entry

The PYTHOPATH variable ... should read
The PYTHONPATH variable ... (missing "N")

in: Book (i.e. printed edition) - first edition (July-2016) - Second release (2017-03-17)

Anonymous  Nov 21, 2017 
Printed Page 79
second code block

The proposed code fails because Dataset no longer supports the *freeze* method; this functionality has been split off into the datafreeze package. Due to a naming conflict within the datafreeze module, equivalent code will fail when using the *freeze* function (import datafreeze ... freeze(winners, format='csv', filename='nobel_winners_ds.csv')).

Anonymous  Mar 03, 2019 
Printed Page 141
Example 5-2

This example does not work as printed (error: "cannot import name 'SignedJwtAssertionCredentials' from 'oauth2client.client' (/anaconda3/lib/python3.7/site-packages/oauth2client/"); the following code provides a working alternative in Python 3 ... from oauth2client.service_account import ServiceAccountCredentials ... scope = ['', ''] ... credentials = ServiceAccountCredentials.from_json_keyfile_name('myProject.json', scope)

Anonymous  Mar 04, 2019 
Printed Page 142
Last paragraph

Printed code fails as written; assumes prior "import pandas as pd" command (Pandas has not been introduced by page 141)

Anonymous  Mar 04, 2019 
Printed Page 153
Code block

The 2016 record includes an unexpected endnote that causes the code provided to fail; this can be fixed by collecting only the first 4 characters of the selected text, e.g. year = int(row.select_one('td').text[0:4])

Anonymous  Mar 04, 2019 
Printed Page 156
Code block

Proposed code fails, as "get_url" is not defined, nor will BeautifulSoup work on the proposed "data" argument; correct by changing "get_url" to "requests.get" and pass BeautifulSoup(data.content) (not "data")

Anonymous  Mar 04, 2019 
Other Digital Version 181
Example 6.4

Kindle Version
Example 6.4 has lines:

h2s = response.xpath('//h2')

for h2 in list(h2s)[:2]:

p_template = '//*[@id="{code}"]/div[2]/div/div/div[2]/div[1]/div/div[2]/div[2]{link_html}/text()'

Due to wiki page structure change. These lines should be changed to:

h2s = response.xpath('//h3')

for h2 in h2s:

p_template = '//*[@id="{code}"]/div[2]/div/div/div[2]/div[1]/div/div[2]/div[2]/div{link_html}/text()'

In addtion, due to Scrapy package update, the parameter
ROBOTSTXT_OBEY should be set to False in file. Otherwise the whole Scrapy process will be blocked

Siyuan Lu  Mar 17, 2019 
Printed Page 211
Bottom of page

"we grab row number two" is accurate but potentially confusing since it's zero based.

I would suggest "we grab the third row" or "we grab the row with the id of `2`"

Lee Trout  Feb 04, 2018 
Printed Page 253
Last paragraph

"Running to_datetime on the date_of_birth field ..." should be corrected to read, "Running to_datetime on the date_of_death field ..."

Anonymous  Mar 08, 2019 
Printed Page 257
Second code block

The following proposed code block does not work:

df_clean, df_born_in = clean_data()

Author appears to have meant or assumed something like the following:

df = reload_data()
df_clean, df_born_in = clean_data(df)

Furthermore, in the subsequent code dataframe_to_mongo(df_clean, 'nobel_prize', 'winners'), the author seems to have intended for the third argument to be 'winners_clean' ("Save the cleaned DataFrame to the nobel_prize database, collection name winners_cleaned.")

Anonymous  Mar 08, 2019 
PDF Page 286
bottom of page

P.286 imports Seaborn as `sb`

But P.307, 309, 310, 311, etc then refer to `sns` ...for (Sam Norman) Seaborn

mbeveridge  Jun 11, 2019 
Printed Page 315
code snippet

spotted couple of minor errors in this excellent book!


in the printed version:


I found this didn't work, but by changing to a seaborn syntax it worked

sb.set(rc={'figure.figsize': (8,8)})


the book imports seaborn as 'sb' on pg 294

on page 315 it uses the prefix sns.[...]

it should use sb for consistency, or switch page 294 to 'sns'

Hope that helps :)

Oliver Harper  Jan 04, 2018 
Other Digital Version 350
3rd paragraph

On kindle the command line shows:

curl -g ******/api/winners?where={"year":{"$gt":2000}, "gender": "female"}

the command line always show could not recognize where statement.
You have to replace " with %22, and , with %2C to make the command line work

cur -g *****/api/winners?where={%22year%22:{%22$gt%22:2000}%2C%22gender%22:%22female%22}

I have to hide the http part as system will not allow me to submit if I include http here

Siyuan Lu  Mar 12, 2019 
Printed Page 416
Example 16.2

"var width = ..." line is ended with , rather than ; and following line starting wiht height needs to be start with "var..." rather than just height.

These are supposed to be 2 separate lines of variable declaration here but it is printed as a single extended statement - which is invalid.

This same error shows up on page 414 in Example 16.1

Corey Halverson  Jul 31, 2019 
ePub Page 459
Kindle sample, Chapter 1, don't know the actual page. First paragraph under Virtual Environments

For readers who've already installed Anaconda with Python 3.x, the first command under Virtual Environments would be instead

$ conda create -n pyjsviz python=2.7 anaconda

Dave Lubertozzi  Mar 19, 2018 
ePub Page 607
Kindle sample,"location 607", don't know the actual page. Chapter 2, Interacting with the Code > Python After last line of last paragraph

You said:
A Jupyter notebook can be started with from the command line with:
$ jupyter notebook

I would add:
The QT console is invoked by:
$ jupyter qtconsole

'ipython qtconsole` works in iPtyhon 5.3.0 but with a warning "is deprecated and will be removed in future versions."

The other command line options above also seem to be deprecated, or maybe I misunderstood how to use them

Dave Lubertozzi  Mar 20, 2018