MCPcopy Create free account
hub / github.com/dask/dask / test_describe

Function test_describe

dask/dataframe/tests/test_dataframe.py:409–476  ·  view source on GitHub ↗
(include, exclude, percentiles, subset)

Source from the content-addressed store, hash-verified

407 ],
408)
409def test_describe(include, exclude, percentiles, subset):
410 data = {
411 "a": ["aaa", "bbb", "bbb", None, None, "zzz"] * 2,
412 "c": [None, 0, 1, 2, 3, 4] * 2,
413 "d": [None, 0, 1] * 4,
414 "e": [
415 pd.Timestamp("2017-05-09 00:00:00.006000"),
416 pd.Timestamp("2017-05-09 00:00:00.006000"),
417 pd.Timestamp("2017-05-09 07:56:23.858694"),
418 pd.Timestamp("2017-05-09 05:59:58.938999"),
419 None,
420 None,
421 ]
422 * 2,
423 "f": [
424 np.timedelta64(3, "D"),
425 np.timedelta64(1, "D"),
426 None,
427 None,
428 np.timedelta64(3, "D"),
429 np.timedelta64(1, "D"),
430 ]
431 * 2,
432 "g": [True, False, True] * 4,
433 }
434
435 # Arrange
436 df = pd.DataFrame(data)
437 df["a"] = df["a"].astype(get_string_dtype())
438
439 if subset is not None:
440 df = df.loc[:, subset]
441
442 ddf = dd.from_pandas(df, 2)
443
444 # Act
445 actual = ddf.describe(
446 include=include,
447 exclude=exclude,
448 percentiles=percentiles,
449 )
450 expected = df.describe(
451 include=include,
452 exclude=exclude,
453 percentiles=percentiles,
454 )
455
456 if "e" in expected:
457 expected = _drop_mean(expected, "e")
458
459 assert_eq(actual, expected)
460
461 if PANDAS_GE_310:
462 # The 'include' and 'exclude' arguments are deprecated for Series.describe and
463 # will be removed in a future version. These arguments have no effect on Series
464 # and will be removed.
465 series_kwargs = {}
466 else:

Callers

nothing calls this directly

Calls 6

describeMethod · 0.95
get_string_dtypeFunction · 0.90
assert_eqFunction · 0.90
_drop_meanFunction · 0.70
astypeMethod · 0.45
describeMethod · 0.45

Tested by

no test coverage detected