(index, deep)
| 4181 | @pytest.mark.parametrize("index", [True, False]) |
| 4182 | @pytest.mark.parametrize("deep", [True, False]) |
| 4183 | def test_memory_usage_per_partition(index, deep): |
| 4184 | df = pd.DataFrame( |
| 4185 | { |
| 4186 | "x": [1, 2, 3, 4, 5], |
| 4187 | "y": [1.0, 2.0, 3.0, 4.0, 5.0], |
| 4188 | "z": ["a", "b", "c", "d", "e"], |
| 4189 | } |
| 4190 | ) |
| 4191 | ddf = dd.from_pandas(df, npartitions=2) |
| 4192 | |
| 4193 | # DataFrame.memory_usage_per_partition |
| 4194 | expected = pd.Series( |
| 4195 | part.compute().memory_usage(index=index, deep=deep).sum() |
| 4196 | for part in ddf.partitions |
| 4197 | ) |
| 4198 | result = ddf.memory_usage_per_partition(index=index, deep=deep) |
| 4199 | assert_eq(expected, result, check_index=False) |
| 4200 | |
| 4201 | # Series.memory_usage_per_partition |
| 4202 | expected = pd.Series( |
| 4203 | part.x.compute().memory_usage(index=index, deep=deep) for part in ddf.partitions |
| 4204 | ) |
| 4205 | result = ddf.x.memory_usage_per_partition(index=index, deep=deep) |
| 4206 | assert_eq(expected, result, check_index=False) |
| 4207 | |
| 4208 | |
| 4209 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected