MCPcopy
hub / github.com/dask/dask / test_memory_usage_dataframe

Function test_memory_usage_dataframe

dask/dataframe/tests/test_dataframe.py:4140–4153  ·  view source on GitHub ↗
(index, deep)

Source from the content-addressed store, hash-verified

4138@pytest.mark.parametrize("index", [True, False])
4139@pytest.mark.parametrize("deep", [True, False])
4140def test_memory_usage_dataframe(index, deep):
4141 df = pd.DataFrame(
4142 {"x": [1, 2, 3], "y": [1.0, 2.0, 3.0], "z": ["a", "b", "c"]},
4143 # Dask will use more memory for a multi-partition
4144 # RangeIndex, so we must set an index explicitly
4145 index=[1, 2, 3],
4146 )
4147 if pyarrow_strings_enabled():
4148 # pandas should measure memory usage of pyarrow strings
4149 df = to_pyarrow_string(df)
4150 ddf = dd.from_pandas(df, npartitions=2)
4151 expected = df.memory_usage(index=index, deep=deep)
4152 result = ddf.memory_usage(index=index, deep=deep)
4153 assert_eq(expected, result)
4154
4155
4156@pytest.mark.parametrize("index", [True, False])

Callers

nothing calls this directly

Calls 4

memory_usageMethod · 0.95
pyarrow_strings_enabledFunction · 0.90
assert_eqFunction · 0.90
memory_usageMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…