Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chapter_preliminaries/pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ with open(data_file, 'w') as f:
# !pip install pandas
import pandas as pd

data = pd.read_csv(data_file)
data = pd.read_csv(data_file, na_values=['NA'])
print(data)
```

Expand All @@ -55,7 +55,7 @@ print(data)
```{.python .input}
#@tab all
inputs, outputs = data.iloc[:, 0:2], data.iloc[:, 2]
inputs = inputs.fillna(inputs.mean())
inputs = inputs.fillna(inputs.select_dtypes(include=['number']).mean())
print(inputs)
```

Expand Down
5 changes: 3 additions & 2 deletions chapter_preliminaries/pandas_origin.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This dataset has four rows and three columns, where each row describes the numbe
# !pip install pandas
import pandas as pd

data = pd.read_csv(data_file)
data = pd.read_csv(data_file, na_values=['NA'])
print(data)
```

Expand All @@ -64,7 +64,7 @@ we [**replace the "NaN" entries with the mean value of the same column.**]
```{.python .input}
#@tab all
inputs, outputs = data.iloc[:, 0:2], data.iloc[:, 2]
inputs = inputs.fillna(inputs.mean())
inputs = inputs.fillna(inputs.select_dtypes(include=['number']).mean())
print(inputs)
```

Expand Down Expand Up @@ -132,3 +132,4 @@ Create a raw dataset with more rows and columns.
:begin_tab:`tensorflow`
[Discussions](https://discuss.d2l.ai/t/195)
:end_tab:

Loading