Skip to content
Merged
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
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ Bug Fixes
- :class:`CheckInputDataFrame` no longer collects Polars LazyFrames automatically;
a ``TypeError`` is now raised instead, consistent with the rest of the library.
:pr:`1941` by :user:`Mudit Atrey <MuditAtrey>`.
- :func:`fetch_employee_salaries` now correctly writes the train and test
split CSV files to their respective paths when ``split`` is specified.
:pr:`1964` by :user:`MuditAtrey <MuditAtrey>`.

Documentation
-------------
- Updated gallery examples to load datasets from their file paths using
``pd.read_csv()``, following the pattern established in :pr:`1852`.
:pr:`1940` by :user:`MuditAtrey <MuditAtrey>`.
:pr:`1940` and :pr:`1964` by :user:`MuditAtrey <MuditAtrey>`.

Release 0.7.2
=============
Expand Down
7 changes: 5 additions & 2 deletions examples/FIXME/07_grid_searching_with_the_tablevectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@
#
# Throughout this example, we will use the employee salaries dataset.

import pandas as pd

from skrub.datasets import fetch_employee_salaries

dataset = fetch_employee_salaries()
X = dataset.X
y = dataset.y
df = pd.read_csv(dataset.employee_salaries_path)
X = df.drop(columns=["current_annual_salary"])
y = df["current_annual_salary"]

X.head(10)

Expand Down
8 changes: 6 additions & 2 deletions examples/data_ops/1110_data_ops_intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@
# By default, the |fetch_employee_salaries| function returns the training set.
# We will load the test set later, to evaluate our model on unseen data.

import pandas as pd

from skrub.datasets import fetch_employee_salaries

training_data = fetch_employee_salaries(split="train").employee_salaries
training_data = pd.read_csv(
fetch_employee_salaries(split="train").employee_salaries_path
)

# %%
# We can take a look at the dataset using the |TableReport|.
Expand Down Expand Up @@ -160,7 +164,7 @@
# case, "data").
#
# We can now get the test set of the employee salaries dataset:
unseen_data = fetch_employee_salaries(split="test").employee_salaries
unseen_data = pd.read_csv(fetch_employee_salaries(split="test").employee_salaries_path)

# %%
# Then, we can use the loaded model to make predictions on the unseen data by
Expand Down
4 changes: 2 additions & 2 deletions skrub/datasets/_fetching.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def fetch_employee_salaries(data_home=None, split="all"):
)
dataset["employee_salaries_path"] = str(train_path)
dataset["path"] = str(train_path)
dataset["employee_salaries"][:id_split].to_csv(str(train_path), index=False)
dataset["employee_salaries"].to_csv(str(train_path), index=False)
dataset["X"] = dataset["X"][:id_split]
dataset["y"] = dataset["y"][:id_split]
elif split == "test":
Expand All @@ -74,7 +74,7 @@ def fetch_employee_salaries(data_home=None, split="all"):
)
dataset["employee_salaries_path"] = str(test_path)
dataset["path"] = str(test_path)
dataset["employee_salaries"][id_split:].to_csv(str(test_path), index=False)
dataset["employee_salaries"].to_csv(str(test_path), index=False)
dataset["X"] = dataset["X"][id_split:]
dataset["y"] = dataset["y"][id_split:]
return dataset
Expand Down
Loading