Skip to content

Commit 215fee8

Browse files
defaults are set to dataframe as part of first step towards issue openml#1115
1 parent 0ec2f85 commit 215fee8

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

openml/datasets/functions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def list_datasets(
120120
size: int | None = None,
121121
status: str | None = None,
122122
tag: str | None = None,
123-
output_format: Literal["dataframe", "dict"] = "dict",
123+
output_format: Literal["dataframe", "dict"] = "dataframe",
124124
**kwargs: Any,
125125
) -> dict | pd.DataFrame:
126126
"""
@@ -141,7 +141,7 @@ def list_datasets(
141141
default active datasets are returned, but also datasets
142142
from another status can be requested.
143143
tag : str, optional
144-
output_format: str, optional (default='dict')
144+
output_format: str, optional (default='dataframe')
145145
The parameter decides the format of the output.
146146
- If 'dict' the output is a dict of dict
147147
- If 'dataframe' the output is a pandas DataFrame
@@ -219,7 +219,7 @@ def _list_datasets(
219219

220220
def _list_datasets(
221221
data_id: list | None = None,
222-
output_format: Literal["dict", "dataframe"] = "dict",
222+
output_format: Literal["dict", "dataframe"] = "dataframe",
223223
**kwargs: Any,
224224
) -> dict | pd.DataFrame:
225225
"""
@@ -234,7 +234,7 @@ def _list_datasets(
234234
235235
data_id : list, optional
236236
237-
output_format: str, optional (default='dict')
237+
output_format: str, optional (default='dataframe')
238238
The parameter decides the format of the output.
239239
- If 'dict' the output is a dict of dict
240240
- If 'dataframe' the output is a pandas DataFrame
@@ -267,7 +267,7 @@ def __list_datasets(api_call: str, output_format: Literal["dataframe"]) -> pd.Da
267267

268268
def __list_datasets(
269269
api_call: str,
270-
output_format: Literal["dict", "dataframe"] = "dict",
270+
output_format: Literal["dict", "dataframe"] = "dataframe",
271271
) -> dict | pd.DataFrame:
272272
xml_string = openml._api_calls._perform_api_call(api_call, "get")
273273
datasets_dict = xmltodict.parse(xml_string, force_list=("oml:dataset",))

openml/evaluations/functions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def list_evaluations(
6666
study: int | None = None,
6767
per_fold: bool | None = None,
6868
sort_order: str | None = None,
69-
output_format: Literal["object", "dict", "dataframe"] = "object",
69+
output_format: Literal["object", "dict", "dataframe"] = "dataframe",
7070
) -> dict | pd.DataFrame:
7171
"""
7272
List all run-evaluation pairs matching all of the given filters.
@@ -102,7 +102,7 @@ def list_evaluations(
102102
sort_order : str, optional
103103
order of sorting evaluations, ascending ("asc") or descending ("desc")
104104
105-
output_format: str, optional (default='object')
105+
output_format: str, optional (default='dataframe')
106106
The parameter decides the format of the output.
107107
- If 'object' the output is a dict of OpenMLEvaluation objects
108108
- If 'dict' the output is a dict of dict
@@ -157,7 +157,7 @@ def _list_evaluations(
157157
uploaders: list | None = None,
158158
study: int | None = None,
159159
sort_order: str | None = None,
160-
output_format: Literal["object", "dict", "dataframe"] = "object",
160+
output_format: Literal["object", "dict", "dataframe"] = "dataframe",
161161
**kwargs: Any,
162162
) -> dict | pd.DataFrame:
163163
"""
@@ -190,7 +190,7 @@ def _list_evaluations(
190190
sort_order : str, optional
191191
order of sorting evaluations, ascending ("asc") or descending ("desc")
192192
193-
output_format: str, optional (default='dict')
193+
output_format: str, optional (default='dataframe')
194194
The parameter decides the format of the output.
195195
- If 'dict' the output is a dict of dict
196196
The parameter decides the format of the output.
@@ -226,7 +226,7 @@ def _list_evaluations(
226226

227227
def __list_evaluations(
228228
api_call: str,
229-
output_format: Literal["object", "dict", "dataframe"] = "object",
229+
output_format: Literal["object", "dict", "dataframe"] = "dataframe",
230230
) -> dict | pd.DataFrame:
231231
"""Helper function to parse API calls which are lists of runs"""
232232
xml_string = openml._api_calls._perform_api_call(api_call, "get")

openml/flows/functions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def list_flows(
168168
offset: int | None = None,
169169
size: int | None = None,
170170
tag: str | None = None,
171-
output_format: Literal["dict", "dataframe"] = "dict",
171+
output_format: Literal["dict", "dataframe"] = "dataframe",
172172
**kwargs: Any,
173173
) -> dict | pd.DataFrame:
174174
"""
@@ -183,7 +183,7 @@ def list_flows(
183183
the maximum number of flows to return
184184
tag : str, optional
185185
the tag to include
186-
output_format: str, optional (default='dict')
186+
output_format: str, optional (default='dataframe')
187187
The parameter decides the format of the output.
188188
- If 'dict' the output is a dict of dict
189189
- If 'dataframe' the output is a pandas DataFrame
@@ -252,14 +252,14 @@ def _list_flows(output_format: Literal["dataframe"], **kwargs: Any) -> pd.DataFr
252252

253253

254254
def _list_flows(
255-
output_format: Literal["dict", "dataframe"] = "dict", **kwargs: Any
255+
output_format: Literal["dict", "dataframe"] = "dataframe", **kwargs: Any
256256
) -> dict | pd.DataFrame:
257257
"""
258258
Perform the api call that return a list of all flows.
259259
260260
Parameters
261261
----------
262-
output_format: str, optional (default='dict')
262+
output_format: str, optional (default='dataframe')
263263
The parameter decides the format of the output.
264264
- If 'dict' the output is a dict of dict
265265
- If 'dataframe' the output is a pandas DataFrame
@@ -393,7 +393,7 @@ def __list_flows(api_call: str, output_format: Literal["dataframe"]) -> pd.DataF
393393

394394

395395
def __list_flows(
396-
api_call: str, output_format: Literal["dict", "dataframe"] = "dict"
396+
api_call: str, output_format: Literal["dict", "dataframe"] = "dataframe"
397397
) -> dict | pd.DataFrame:
398398
"""Retrieve information about flows from OpenML API
399399
and parse it to a dictionary or a Pandas DataFrame.

openml/runs/functions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ def list_runs( # noqa: PLR0913
10631063
tag: str | None = None,
10641064
study: int | None = None,
10651065
display_errors: bool = False, # noqa: FBT001, FBT002
1066-
output_format: Literal["dict", "dataframe"] = "dict",
1066+
output_format: Literal["dict", "dataframe"] = "dataframe",
10671067
**kwargs: Any,
10681068
) -> dict | pd.DataFrame:
10691069
"""
@@ -1095,7 +1095,7 @@ def list_runs( # noqa: PLR0913
10951095
Whether to list runs which have an error (for example a missing
10961096
prediction file).
10971097
1098-
output_format: str, optional (default='dict')
1098+
output_format: str, optional (default='dataframe')
10991099
The parameter decides the format of the output.
11001100
- If 'dict' the output is a dict of dict
11011101
- If 'dataframe' the output is a pandas DataFrame
@@ -1156,7 +1156,7 @@ def _list_runs( # noqa: PLR0913
11561156
uploader: list | None = None,
11571157
study: int | None = None,
11581158
display_errors: bool = False, # noqa: FBT002, FBT001
1159-
output_format: Literal["dict", "dataframe"] = "dict",
1159+
output_format: Literal["dict", "dataframe"] = "dataframe",
11601160
**kwargs: Any,
11611161
) -> dict | pd.DataFrame:
11621162
"""
@@ -1186,7 +1186,7 @@ def _list_runs( # noqa: PLR0913
11861186
Whether to list runs which have an error (for example a missing
11871187
prediction file).
11881188
1189-
output_format: str, optional (default='dict')
1189+
output_format: str, optional (default='dataframe')
11901190
The parameter decides the format of the output.
11911191
- If 'dict' the output is a dict of dict
11921192
- If 'dataframe' the output is a pandas DataFrame
@@ -1221,7 +1221,7 @@ def _list_runs( # noqa: PLR0913
12211221

12221222

12231223
def __list_runs(
1224-
api_call: str, output_format: Literal["dict", "dataframe"] = "dict"
1224+
api_call: str, output_format: Literal["dict", "dataframe"] = "dataframe"
12251225
) -> dict | pd.DataFrame:
12261226
"""Helper function to parse API calls which are lists of runs"""
12271227
xml_string = openml._api_calls._perform_api_call(api_call, "get")

openml/setups/functions.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def list_setups( # noqa: PLR0913
134134
flow: int | None = None,
135135
tag: str | None = None,
136136
setup: Iterable[int] | None = None,
137-
output_format: Literal["object", "dict", "dataframe"] = "object",
137+
output_format: Literal["object", "dict", "dataframe"] = "dataframe",
138138
) -> dict | pd.DataFrame:
139139
"""
140140
List all setups matching all of the given filters.
@@ -146,7 +146,7 @@ def list_setups( # noqa: PLR0913
146146
flow : int, optional
147147
tag : str, optional
148148
setup : Iterable[int], optional
149-
output_format: str, optional (default='object')
149+
output_format: str, optional (default='dataframe')
150150
The parameter decides the format of the output.
151151
- If 'dict' the output is a dict of dict
152152
- If 'dataframe' the output is a pandas DataFrame
@@ -184,7 +184,7 @@ def list_setups( # noqa: PLR0913
184184

185185
def _list_setups(
186186
setup: Iterable[int] | None = None,
187-
output_format: Literal["dict", "dataframe", "object"] = "object",
187+
output_format: Literal["dict", "dataframe", "object"] = "dataframe",
188188
**kwargs: Any,
189189
) -> dict[int, dict] | pd.DataFrame | dict[int, OpenMLSetup]:
190190
"""
@@ -197,7 +197,7 @@ def _list_setups(
197197
198198
setup : list(int), optional
199199
200-
output_format: str, optional (default='dict')
200+
output_format: str, optional (default='dataframe')
201201
The parameter decides the format of the output.
202202
- If 'dict' the output is a dict of dict
203203
- If 'dataframe' the output is a pandas DataFrame
@@ -221,7 +221,7 @@ def _list_setups(
221221

222222

223223
def __list_setups(
224-
api_call: str, output_format: Literal["dict", "dataframe", "object"] = "object"
224+
api_call: str, output_format: Literal["dict", "dataframe", "object"] = "dataframe"
225225
) -> dict[int, dict] | pd.DataFrame | dict[int, OpenMLSetup]:
226226
"""Helper function to parse API calls which are lists of setups"""
227227
xml_string = openml._api_calls._perform_api_call(api_call, "get")
@@ -328,7 +328,7 @@ def _to_dict(
328328

329329

330330
def _create_setup_from_xml(
331-
result_dict: dict, output_format: Literal["dict", "dataframe", "object"] = "object"
331+
result_dict: dict, output_format: Literal["dict", "dataframe", "object"] = "dataframe"
332332
) -> OpenMLSetup | dict[str, int | dict[int, Any] | None]:
333333
"""Turns an API xml result into a OpenMLSetup object (or dict)"""
334334
if output_format in ["dataframe", "dict"]:

openml/tasks/functions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def list_tasks(
131131
offset: int | None = None,
132132
size: int | None = None,
133133
tag: str | None = None,
134-
output_format: Literal["dict", "dataframe"] = "dict",
134+
output_format: Literal["dict", "dataframe"] = "dataframe",
135135
**kwargs: Any,
136136
) -> dict | pd.DataFrame:
137137
"""
@@ -150,7 +150,7 @@ def list_tasks(
150150
the maximum number of tasks to show
151151
tag : str, optional
152152
the tag to include
153-
output_format: str, optional (default='dict')
153+
output_format: str, optional (default='dataframe')
154154
The parameter decides the format of the output.
155155
- If 'dict' the output is a dict of dict
156156
- If 'dataframe' the output is a pandas DataFrame
@@ -197,7 +197,7 @@ def list_tasks(
197197

198198
def _list_tasks(
199199
task_type: TaskType | None = None,
200-
output_format: Literal["dict", "dataframe"] = "dict",
200+
output_format: Literal["dict", "dataframe"] = "dataframe",
201201
**kwargs: Any,
202202
) -> dict | pd.DataFrame:
203203
"""
@@ -210,7 +210,7 @@ def _list_tasks(
210210
type when used as a filter in list tasks call.
211211
task_type : TaskType, optional
212212
Refers to the type of task.
213-
output_format: str, optional (default='dict')
213+
output_format: str, optional (default='dataframe')
214214
The parameter decides the format of the output.
215215
- If 'dict' the output is a dict of dict
216216
- If 'dataframe' the output is a pandas DataFrame
@@ -238,7 +238,7 @@ def _list_tasks(
238238
# TODO(eddiebergman): overload todefine type returned
239239
def __list_tasks( # noqa: PLR0912, C901
240240
api_call: str,
241-
output_format: Literal["dict", "dataframe"] = "dict",
241+
output_format: Literal["dict", "dataframe"] = "dataframe",
242242
) -> dict | pd.DataFrame:
243243
"""Returns a dictionary or a Pandas DataFrame with information about OpenML tasks.
244244

openml/tasks/task.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def get_X_and_y(
295295

296296
# TODO(eddiebergman): Do all OpenMLSupervisedTask have a `y`?
297297
def get_X_and_y(
298-
self, dataset_format: Literal["dataframe", "array"] = "array"
298+
self, dataset_format: Literal["dataframe", "array"] = "dataframe"
299299
) -> tuple[
300300
np.ndarray | pd.DataFrame | scipy.sparse.spmatrix,
301301
np.ndarray | pd.Series | pd.DataFrame | None,
@@ -547,7 +547,7 @@ def get_X(self, dataset_format: Literal["dataframe"]) -> pd.DataFrame: ...
547547

548548
def get_X(
549549
self,
550-
dataset_format: Literal["array", "dataframe"] = "array",
550+
dataset_format: Literal["array", "dataframe"] = "dataframe",
551551
) -> np.ndarray | pd.DataFrame | scipy.sparse.spmatrix:
552552
"""Get data associated with the current task.
553553

0 commit comments

Comments
 (0)