Skip to content

Commit a8c3389

Browse files
csejournercap107Vincent-Maladiere
authored
add sizes of dataframes and total sizes on disk (#1503)
Co-authored-by: Riccardo Cappuzzo <7548232+rcap107@users.noreply.github.com> Co-authored-by: Vincent M <maladiere.vincent@yahoo.fr> Co-authored-by: Riccardo Cappuzzo <riccardo.cappuzzo@gmail.com>
1 parent 4baec8a commit a8c3389

1 file changed

Lines changed: 90 additions & 62 deletions

File tree

skrub/datasets/_fetching.py

Lines changed: 90 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def fetch_employee_salaries(data_home=None, split="all"):
1414
active, permanent employees of Montgomery County, MD paid in calendar
1515
year 2016. This dataset is a copy of https://www.openml.org/d/42125
1616
where some features are dropped to avoid data leaking.
17+
Size on disk: 1.3MB.
1718
1819
.. note::
1920
@@ -39,10 +40,12 @@ def fetch_employee_salaries(data_home=None, split="all"):
3940
bunch : sklearn.utils.Bunch
4041
A dictionary-like object with the following keys:
4142
42-
- employee_salaries : pd.DataFrame, the dataframe
43-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
44-
- y : pd.DataFrame, target labels
45-
- metadata : a dictionary containing the name, description, source and target
43+
- ``employee_salaries`` : pd.DataFrame, the dataframe. Shape: (9228, 9)
44+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
45+
labels. Shape: (9228, 8)
46+
- ``y`` : pd.DataFrame, target labels. Shape: (9228, 1)
47+
- ``metadata`` : a dictionary containing the name, description, source and
48+
target
4649
"""
4750
if split not in ["train", "test", "all"]:
4851
raise ValueError(
@@ -75,6 +78,7 @@ def fetch_medical_charge(data_home=None):
7578
receive Medicare Inpatient Prospective Payment System (IPPS) payments.
7679
The PUF is organized by hospital and Medicare Severity Diagnosis
7780
Related Group (MS-DRG) and covers Fiscal Year (FY) 2011 through FY 2016.
81+
Size on disk: 36MB.
7882
7983
Parameters
8084
----------
@@ -86,10 +90,12 @@ def fetch_medical_charge(data_home=None):
8690
bunch : sklearn.utils.Bunch
8791
A dictionary-like object with the following keys:
8892
89-
- medical_charge : pd.DataFrame, the dataframe
90-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
91-
- y : pd.DataFrame, target labels
92-
- metadata : a dictionary containing the name, description, source and target
93+
- ``medical_charge`` : pd.DataFrame, the dataframe. Shape: (163065, 12)
94+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
95+
labels. Shape: (163065, 11)
96+
- ``y`` : pd.DataFrame, target labels. Shape: (163065, 1)
97+
- ``metadata`` : a dictionary containing the name, description, source and
98+
target
9399
"""
94100
return load_simple_dataset("medical_charge", data_home)
95101

@@ -99,7 +105,7 @@ def fetch_midwest_survey(data_home=None):
99105
https://github.com/skrub-data/skrub-data-files
100106
101107
Description of the dataset:
102-
Survey to know if people self-identify as Midwesterners.
108+
Survey to know if people self-identify as Midwesterners. Size on disk: 504KB.
103109
104110
Parameters
105111
----------
@@ -111,10 +117,12 @@ def fetch_midwest_survey(data_home=None):
111117
bunch : sklearn.utils.Bunch
112118
A dictionary-like object with the following keys:
113119
114-
- midwest_survey : pd.DataFrame, the dataframe
115-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
116-
- y : pd.DataFrame, target labels
117-
- metadata : a dictionary containing the name, description, source and target
120+
- ``midwest_survey`` : pd.DataFrame, the dataframe. Shape: (2494, 29)
121+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
122+
labels. Shape: (2494, 28)
123+
- ``y`` : pd.DataFrame, target labels. Shape: (2494, 1)
124+
- ``metadata`` : a dictionary containing the name, description, source and
125+
target
118126
"""
119127
return load_simple_dataset("midwest_survey", data_home)
120128

@@ -125,7 +133,7 @@ def fetch_open_payments(data_home=None):
125133
126134
Description of the dataset:
127135
Payments given by healthcare manufacturing companies to medical doctors
128-
or hospitals.
136+
or hospitals. Size on disk: 8.7MB.
129137
130138
Parameters
131139
----------
@@ -137,10 +145,12 @@ def fetch_open_payments(data_home=None):
137145
bunch : sklearn.utils.Bunch
138146
A dictionary-like object with the following keys:
139147
140-
- open_payments : pd.DataFrame, the dataframe
141-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
142-
- y : pd.DataFrame, target labels
143-
- metadata : a dictionary containing the name, description, source and target
148+
- ``open_payments`` : pd.DataFrame, the dataframe. Shape: (73558, 6)
149+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
150+
labels. Shape: (73558, 5)
151+
- ``y`` : pd.DataFrame, target labels. Shape: (73558, 1)
152+
- ``metadata`` : a dictionary containing the name, description, source
153+
and target
144154
"""
145155
return load_simple_dataset("open_payments", data_home)
146156

@@ -153,7 +163,7 @@ def fetch_traffic_violations(data_home=None):
153163
This dataset contains traffic violation information from all electronic
154164
traffic violations issued in the Montgomery County, MD. Any information
155165
that can be used to uniquely identify the vehicle, the vehicle owner or
156-
the officer issuing the violation will not be published.
166+
the officer issuing the violation will not be published. Size on disk: 736MB.
157167
158168
Parameters
159169
----------
@@ -165,10 +175,12 @@ def fetch_traffic_violations(data_home=None):
165175
bunch : sklearn.utils.Bunch
166176
A dictionary-like object with the following keys:
167177
168-
- traffic_violations : pd.DataFrame, the dataframe
169-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
170-
- y : pd.DataFrame, target labels
171-
- metadata : a dictionary containing the name, description, source and target
178+
- ``traffic_violations`` : pd.DataFrame, the dataframe. Shape: (1578154, 43)
179+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
180+
labels. Shape: (1578154, 42)
181+
- ``y`` : pd.DataFrame, target labels. Shape: (1578154, 1)
182+
- ``metadata`` : a dictionary containing the name, description, source and
183+
target
172184
"""
173185
return load_simple_dataset("traffic_violations", data_home)
174186

@@ -179,7 +191,7 @@ def fetch_drug_directory(data_home=None):
179191
180192
Description of the dataset:
181193
Product listing data submitted to the U.S. FDA for all unfinished,
182-
unapproved drugs.
194+
unapproved drugs. Size on disk: 44MB.
183195
184196
Parameters
185197
----------
@@ -191,10 +203,12 @@ def fetch_drug_directory(data_home=None):
191203
bunch : sklearn.utils.Bunch
192204
A dictionary-like object with the following keys:
193205
194-
- drug_directory : pd.DataFrame, the dataframe
195-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
196-
- y : pd.DataFrame, target labels
197-
- metadata : a dictionary containing the name, description, source and target
206+
- ``drug_directory`` : pd.DataFrame, the dataframe. Shape: (120215, 21)
207+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
208+
labels. Shape: (120215, 20)
209+
- ``y`` : pd.DataFrame, target labels. Shape: (120215, 1)
210+
- ``metadata`` : a dictionary containing the name, description, source and
211+
target
198212
"""
199213
return load_simple_dataset("drug_directory", data_home)
200214

@@ -211,6 +225,7 @@ def fetch_credit_fraud(data_home=None, split="train"):
211225
212226
Baskets contain at least one product each, so aggregation then joining operations
213227
are required to build a design matrix.
228+
Size on disk: 16MB.
214229
215230
Parameters
216231
----------
@@ -225,10 +240,12 @@ def fetch_credit_fraud(data_home=None, split="train"):
225240
bunch : sklearn.utils.Bunch
226241
A dictionary-like object with the following keys:
227242
228-
- baskets : pd.DataFrame, table containing baskets ID and target
229-
- product : pd.DataFrame, table containing features about products contained in
230-
baskets
231-
- metadata : a dictionary containing the name, description, source and target
243+
- ``baskets`` : pd.DataFrame, table containing baskets ID and target.
244+
Shape: (92790, 2)
245+
- ``product`` : pd.DataFrame, table containing features about products
246+
contained in baskets. Shape: (163357, 7)
247+
- ``metadata`` : a dictionary containing the name, description, source and
248+
target
232249
"""
233250
if split not in ["train", "test", "all"]:
234251
raise ValueError(
@@ -254,6 +271,7 @@ def fetch_toxicity(data_home=None):
254271
consists in only two columns:
255272
- `text`: the text of the comment
256273
- `is_toxic`: whether or not the comment is toxic
274+
Size on disk: 220KB.
257275
258276
Parameters
259277
----------
@@ -265,10 +283,12 @@ def fetch_toxicity(data_home=None):
265283
bunch : sklearn.utils.Bunch
266284
A dictionary-like object with the following keys:
267285
268-
- toxicity : pd.DataFrame, the dataframe
269-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
270-
- y : pd.DataFrame, target labels
271-
- metadata : a dictionary containing the name, description, source and target
286+
- ``toxicity`` : pd.DataFrame, the dataframe. Shape: (1000, 2)
287+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
288+
labels. Shape: (1000, 1)
289+
- ``y`` : pd.DataFrame, target labels. Shape: (1000, 1)
290+
- ``metadata`` : a dictionary containing the name, description, source and
291+
target
272292
"""
273293
return load_simple_dataset("toxicity", data_home)
274294

@@ -279,7 +299,7 @@ def fetch_videogame_sales(data_home=None):
279299
280300
This is a regression use-case, where the single table contains information
281301
about videogames such as the publisher and platform, and the goal is to
282-
predict the number of sales worldwide.
302+
predict the number of sales worldwide. Size on disk: 1.8MB.
283303
284304
.. warning::
285305
@@ -298,10 +318,11 @@ def fetch_videogame_sales(data_home=None):
298318
bunch : sklearn.utils.Bunch
299319
A dictionary-like object with the following keys:
300320
301-
- videogame_sales : pd.DataFrame, the full dataframe
302-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
303-
- y : pd.DataFrame, target labels
304-
- metadata : a dictionary containing the name, source and target
321+
- ``videogame_sales`` : pd.DataFrame, the full dataframe. Shape: (16572, 11)
322+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target
323+
labels. Shape: (16572, 5)
324+
- ``y`` : pd.DataFrame, target labels. Shape: (16572, 1)
325+
- ``metadata`` : a dictionary containing the name, source and target
305326
"""
306327

307328
result = load_simple_dataset("videogame_sales", data_home)
@@ -317,7 +338,7 @@ def fetch_bike_sharing(data_home=None):
317338
318339
This is a regression use-case, where the goal is to predict demand for a
319340
bike-sharing service. The features are the dates and holiday and weather
320-
information.
341+
information. Size on disk: 1.3MB.
321342
322343
Parameters
323344
----------
@@ -329,10 +350,11 @@ def fetch_bike_sharing(data_home=None):
329350
bunch : sklearn.utils.Bunch
330351
A dictionary-like object with the following keys:
331352
332-
- bike_sharing : pd.DataFrame, the full dataframe
333-
- X : pd.DataFrame, features, i.e. the dataframe without the target labels
334-
- y : pd.DataFrame, target labels
335-
- metadata : a dictionary containing the name and target
353+
- ``bike_sharing``: pd.DataFrame, the full dataframe. Shape: (17379, 11)
354+
- ``X`` : pd.DataFrame, features, i.e. the dataframe without the target labels.
355+
Shape: (17379, 10)
356+
- ``y`` : pd.DataFrame, target labels. Shape: (17379, 1)
357+
- ``metadata`` : a dictionary containing the name and target
336358
"""
337359

338360
return load_simple_dataset("bike_sharing", data_home)
@@ -344,6 +366,7 @@ def fetch_movielens(data_home=None):
344366
345367
This is a regression use-case, where the goal is to predict movie ratings.
346368
More details are provided in the output's ``metadata['description']``.
369+
Size on disk: 3.6MB.
347370
348371
Parameters
349372
----------
@@ -355,9 +378,9 @@ def fetch_movielens(data_home=None):
355378
bunch : sklearn.utils.Bunch
356379
A dictionary-like object with the following keys:
357380
358-
- movies : pd.DataFrame, movie ID, title and genres
359-
- ratings: pd.DataFrame, user ID, movie ID, rating
360-
- metadata : a dictionary containing the name source and description
381+
- ``movies`` : pd.DataFrame, movie ID, title and genres. Shape: (9742, 3)
382+
- ``ratings``: pd.DataFrame, user ID, movie ID, rating. Shape: (100836, 4)
383+
- ``metadata`` : a dictionary containing the name source and description
361384
"""
362385

363386
return load_dataset_files("movielens", data_home)
@@ -368,6 +391,7 @@ def fetch_flight_delays(data_home=None):
368391
https://github.com/skrub-data/skrub-data-files
369392
370393
This is a regression use-case, where the goal is to predict flight delays.
394+
Size on disk: 657MB.
371395
372396
Parameters
373397
----------
@@ -379,20 +403,20 @@ def fetch_flight_delays(data_home=None):
379403
bunch : sklearn.utils.Bunch
380404
A dictionary-like object with the following keys:
381405
382-
- flights: information about the flights, including departure and
383-
arrival airports, and delay.
384-
- airports: information about airports, such as city and coordinates.
406+
- ``flights``: information about the flights, including departure and
407+
arrival airports, and delay. Shape: (2370030, 12)
408+
- ``airports``: information about airports, such as city and coordinates.
385409
The airport's ``iata`` can be matched to the flights' ``Origin`` and
386-
``Dest``.
387-
- weather: weather data that could be used to help improve the delay
410+
``Dest``. Shape: (3376, 7)
411+
- ``weather``: weather data that could be used to help improve the delay
388412
predictions. Note the weather data is not measured at the airports
389413
directly but at weather stations, whose location and information is
390-
provided in ``stations``.
391-
- stations: information about the weather stations. ``weather`` and
414+
provided in ``stations``. Shape: (11282238, 5)
415+
- ``stations``: information about the weather stations. ``weather`` and
392416
``stations`` can be joined on their ``ID`` columns. Weather stations
393417
can only be matched to the nearest airport based on the latitude and
394-
longitude.
395-
- metadata : a dictionary containing the name of the dataset.
418+
longitude. Shape: (124245, 9)
419+
- ``metadata`` : a dictionary containing the name of the dataset.
396420
"""
397421
return load_dataset_files("flight_delays", data_home)
398422

@@ -404,7 +428,7 @@ def fetch_country_happiness(data_home=None):
404428
This is a regression use-case, where the goal is to predict the happiness
405429
index. The dataset contains data from the `2022 World Happiness Report
406430
<https://worldhappiness.report/>`_, and from `the World Bank open data
407-
platform <https://data.worldbank.org/>`_.
431+
platform <https://data.worldbank.org/>`_. Size on disk: 64KB.
408432
409433
Parameters
410434
----------
@@ -416,8 +440,12 @@ def fetch_country_happiness(data_home=None):
416440
bunch : sklearn.utils.Bunch
417441
A dictionary-like object with the following keys:
418442
419-
- ``happiness_report``: dataframe, data from the world happiness report
420-
- ``GDP_per_capita``, ``life_expectancy``, ``legal_rights_index``:
421-
corresponding tables from the World Bank.
443+
- ``happiness_report``: dataframe, data from the world happiness report.
444+
Shape: (146, 12)
445+
- ``GDP_per_capita``: dataframe from the World Bank. Shape: (262, 2)
446+
- ``life_expectancy``: dataframe from the World Bank. Shape: (260, 2)
447+
- ``legal_rights_index``: dataframe from the World Bank. Shape: (238, 2)
448+
- ``metadata`` : a dictionary containing the name of the dataset, a
449+
description and the sources.
422450
"""
423451
return load_dataset_files("country_happiness", data_home)

0 commit comments

Comments
 (0)