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

Function test_memory_usage_dataframe

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

Source from the content-addressed store, hash-verified

4129@pytest.mark.parametrize("index", [True, False])
4130@pytest.mark.parametrize("deep", [True, False])
4131def test_memory_usage_dataframe(index, deep):
4132 df = pd.DataFrame(
4133 {"x": [1, 2, 3], "y": [1.0, 2.0, 3.0], "z": ["a", "b", "c"]},
4134 # Dask will use more memory for a multi-partition
4135 # RangeIndex, so we must set an index explicitly
4136 index=[1, 2, 3],
4137 )
4138 if pyarrow_strings_enabled():
4139 # pandas should measure memory usage of pyarrow strings
4140 df = to_pyarrow_string(df)
4141 ddf = dd.from_pandas(df, npartitions=2)
4142 expected = df.memory_usage(index=index, deep=deep)
4143 result = ddf.memory_usage(index=index, deep=deep)
4144 assert_eq(expected, result)
4145
4146
4147@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