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