MCPcopy Index your code
hub / github.com/plotly/plotly.py / experiment

Function experiment

plotly/data/__init__.py:269–302  ·  view source on GitHub ↗

Each row in this wide dataset represents the results of 100 simulated participants on three hypothetical experiments, along with their gender and control/treatment group. Parameters ---------- indexed: bool If True, then the index is named "participant". Applica

(indexed=False, return_type="pandas")

Source from the content-addressed store, hash-verified

267
268
269def experiment(indexed=False, return_type="pandas"):
270 """
271 Each row in this wide dataset represents the results of 100 simulated participants
272 on three hypothetical experiments, along with their gender and control/treatment group.
273
274 Parameters
275 ----------
276 indexed: bool
277 If True, then the index is named "participant".
278 Applicable only if `return_type='pandas'`
279
280 return_type: {'pandas', 'polars', 'pyarrow', 'modin', 'cudf'}
281 Type of the resulting dataframe
282
283 Returns
284 -------
285 Dataframe of `return_type` type
286 Dataframe with 100 rows and the following columns:
287 `['experiment_1', 'experiment_2', 'experiment_3', 'gender', 'group']`.
288 If `indexed` is True, the data frame index is named "participant"
289 """
290
291 if indexed and return_type not in BACKENDS_WITH_INDEX_SUPPORT:
292 msg = f"Backend '{return_type}' does not support setting index"
293 raise NotImplementedError(msg)
294
295 df = nw.from_native(
296 _get_dataset("experiment", return_type=return_type), eager_only=True
297 )
298 if indexed: # then it must be pandas
299 df = df.to_native()
300 df.index.name = "participant"
301 return df
302 return df.to_native()
303
304
305def medals_wide(indexed=False, return_type="pandas"):

Callers

nothing calls this directly

Calls 1

_get_datasetFunction · 0.85

Tested by

no test coverage detected