Skip to content

Commit c24212c

Browse files
committed
DOC update remaining gallery examples to load datasets from paths
1 parent d9be7aa commit c24212c

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ Documentation
7272
- Updated gallery examples to load datasets from their file paths using
7373
``pd.read_csv()``, following the pattern established in :pr:`1852`.
7474
:pr:`1940` by :user:`MuditAtrey <MuditAtrey>`.
75+
- Updated remaining gallery examples to load datasets from their file paths using
76+
``pd.read_csv()``, following the pattern established in :pr:`1852` and :pr:`1940`.
77+
:pr:`1964` by :user:`MuditAtrey <MuditAtrey>`.
7578

7679
Release 0.7.2
7780
=============

examples/FIXME/07_grid_searching_with_the_tablevectorizer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@
3232
#
3333
# Throughout this example, we will use the employee salaries dataset.
3434

35+
import pandas as pd
36+
3537
from skrub.datasets import fetch_employee_salaries
3638

3739
dataset = fetch_employee_salaries()
38-
X = dataset.X
39-
y = dataset.y
40+
df = pd.read_csv(dataset.employee_salaries_path)
41+
X = df.drop(columns=["current_annual_salary"])
42+
y = df["current_annual_salary"]
4043

4144
X.head(10)
4245

examples/data_ops/1110_data_ops_intro.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@
4646
# By default, the |fetch_employee_salaries| function returns the training set.
4747
# We will load the test set later, to evaluate our model on unseen data.
4848

49+
import pandas as pd
50+
4951
from skrub.datasets import fetch_employee_salaries
5052

51-
training_data = fetch_employee_salaries(split="train").employee_salaries
53+
training_data = pd.read_csv(
54+
fetch_employee_salaries(split="train").employee_salaries_path
55+
)
5256

5357
# %%
5458
# We can take a look at the dataset using the |TableReport|.
@@ -160,7 +164,7 @@
160164
# case, "data").
161165
#
162166
# We can now get the test set of the employee salaries dataset:
163-
unseen_data = fetch_employee_salaries(split="test").employee_salaries
167+
unseen_data = pd.read_csv(fetch_employee_salaries(split="test").employee_salaries_path)
164168

165169
# %%
166170
# Then, we can use the loaded model to make predictions on the unseen data by

0 commit comments

Comments
 (0)