Errata

Hands-On Machine Learning with Scikit-Learn and PyTorch

Errata for Hands-On Machine Learning with Scikit-Learn and PyTorch

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
O'Reilly learning platform Page toc
all

All TOC entries are randomly duplicated. It is at least twice too long, unusable.

Anonymous  Oct 27, 2025 
O'Reilly learning platform Page Handling Text and Categorical Attributes
last para

df_output = pd.DataFrame(cat_encoder.transform(df_test_unknown),
... columns=cat_encoder.get_feature_names_out(),
... index=df_test_unknown.index)

results in error:
ValueError: Shape of passed values is (2, 1), indices imply (2, 5)

We should explicitly convert the sparse matrix returned by cat_encoder.transform() to a dense NumPy array using .toarray() before creating the DataFrame.

Pradeep  Nov 14, 2025