This dataset represents the medal table for Olympic Short Track Speed Skating for the top three nations as of 2020. Parameters ---------- indexed: bool Whether or not the 'nation' column is used as the index and the column index is named 'medal'. Applicable only
(indexed=False, return_type="pandas")
| 303 | |
| 304 | |
| 305 | def medals_wide(indexed=False, return_type="pandas"): |
| 306 | """ |
| 307 | This dataset represents the medal table for Olympic Short Track Speed Skating for the |
| 308 | top three nations as of 2020. |
| 309 | |
| 310 | Parameters |
| 311 | ---------- |
| 312 | indexed: bool |
| 313 | Whether or not the 'nation' column is used as the index and the column index |
| 314 | is named 'medal'. Applicable only if `return_type='pandas'` |
| 315 | |
| 316 | return_type: {'pandas', 'polars', 'pyarrow', 'modin', 'cudf'} |
| 317 | Type of the resulting dataframe |
| 318 | |
| 319 | Returns |
| 320 | ------- |
| 321 | Dataframe of `return_type` type |
| 322 | Dataframe with 3 rows and the following columns: |
| 323 | `['nation', 'gold', 'silver', 'bronze']`. |
| 324 | If `indexed` is True, the 'nation' column is used as the index and the column index |
| 325 | is named 'medal' |
| 326 | """ |
| 327 | |
| 328 | if indexed and return_type not in BACKENDS_WITH_INDEX_SUPPORT: |
| 329 | msg = f"Backend '{return_type}' does not support setting index" |
| 330 | raise NotImplementedError(msg) |
| 331 | |
| 332 | df = nw.from_native( |
| 333 | _get_dataset("medals", return_type=return_type), eager_only=True |
| 334 | ) |
| 335 | if indexed: # then it must be pandas |
| 336 | df = df.to_native().set_index("nation") |
| 337 | df.columns.name = "medal" |
| 338 | return df |
| 339 | return df.to_native() |
| 340 | |
| 341 | |
| 342 | def medals_long(indexed=False, return_type="pandas"): |
nothing calls this directly
no test coverage detected