Replies: 1 comment
-
Thanks! I added it here #180 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear Sebastian,
I'm currently going through your amazing book and I'm enjoying it very much and also learning quite a lot. Thank you very much for everything!
I believe my pdf version of the book is the one published in February 2022, the production reference is 3220222.
I'm using PyCharm Community Edition 2024.1.1 with pandas version 2.2.2 installed. When I type the code on pages 432-433 (specifically, the part where the for-loop is defined for normalizing the numeric column names on page 433), I get the following warning for both df_train_norm and df_test_norm:
FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas.
This is probably due to a newer version of pandas.
The original version of the code (copied from https://github.com/rasbt/machine-learning-book/blob/main/ch13/ch13_part2.py) looks like the following. Please also note that there are two spaces instead of one in "std = train_stats..." in the third line:
for col_name in numeric_column_names:
mean = train_stats.loc[col_name, 'mean']
std = train_stats.loc[col_name, 'std']
df_train_norm.loc[:, col_name] = (df_train_norm.loc[:, col_name] - mean)/std
df_test_norm.loc[:, col_name] = (df_test_norm.loc[:, col_name] - mean)/std
I played around with the code a bit and the following doesn't generate any warnings:
for col_name in numeric_column_names:
mean = train_stats.loc[col_name, 'mean']
std = train_stats.loc[col_name, 'std']
df_train_norm[col_name] = (df_train_norm[col_name] - mean) / std
df_test_norm[col_name] = (df_test_norm[col_name] - mean) / std
I'm still learning, so please disregard this post if it doesn't make any sense or if there's a mistake on my part. In any case, I hope this helps.
Once again, thanks a lot for your hard work and looking forward very much to your new book!
Jevgenij
Beta Was this translation helpful? Give feedback.
All reactions