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

Function test_memory_usage_dataframe

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

Source from the content-addressed store, hash-verified

4150@pytest.mark.parametrize("index", [True, False])
4151@pytest.mark.parametrize("deep", [True, False])
4152def test_memory_usage_dataframe(index, deep):
4153 df = pd.DataFrame(
4154 {"x": [1, 2, 3], "y": [1.0, 2.0, 3.0], "z": ["a", "b", "c"]},
4155 # Dask will use more memory for a multi-partition
4156 # RangeIndex, so we must set an index explicitly
4157 index=[1, 2, 3],
4158 )
4159 if pyarrow_strings_enabled():
4160 # pandas should measure memory usage of pyarrow strings
4161 df = to_pyarrow_string(df)
4162 ddf = dd.from_pandas(df, npartitions=2)
4163 expected = df.memory_usage(index=index, deep=deep)
4164 result = ddf.memory_usage(index=index, deep=deep)
4165 assert_eq(expected, result)
4166
4167
4168@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