Skip to content

docs: the code will raise error if is executed in chapter_preliminaries's pandas.md - #1418

Open
Halory-Ito wants to merge 2 commits into
d2l-ai:masterfrom
Halory-Ito:master
Open

docs: the code will raise error if is executed in chapter_preliminaries's pandas.md#1418
Halory-Ito wants to merge 2 commits into
d2l-ai:masterfrom
Halory-Ito:master

Conversation

@Halory-Ito

Copy link
Copy Markdown
inputs, outputs = data.iloc[:, 0:2], data.iloc[:, 2]

inputs = inputs.apply(pd.to_numeric, errors='coerce') 
# without this line, will raise TypeError: Cannot perform reduction 'mean' with string dtype


inputs = inputs.fillna(inputs.mean())
print(inputs)

here is the error screenshot:
图片

Added conversion of inputs to numeric type to avoid TypeError.
Added input conversion to numeric type to avoid TypeError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant