(index, deep)
| 4193 | @pytest.mark.parametrize("index", [True, False]) |
| 4194 | @pytest.mark.parametrize("deep", [True, False]) |
| 4195 | def test_memory_usage_per_partition(index, deep): |
| 4196 | df = pd.DataFrame( |
| 4197 | { |
| 4198 | "x": [1, 2, 3, 4, 5], |
| 4199 | "y": [1.0, 2.0, 3.0, 4.0, 5.0], |
| 4200 | "z": ["a", "b", "c", "d", "e"], |
| 4201 | } |
| 4202 | ) |
| 4203 | ddf = dd.from_pandas(df, npartitions=2) |
| 4204 | |
| 4205 | # DataFrame.memory_usage_per_partition |
| 4206 | expected = pd.Series( |
| 4207 | part.compute().memory_usage(index=index, deep=deep).sum() |
| 4208 | for part in ddf.partitions |
| 4209 | ) |
| 4210 | result = ddf.memory_usage_per_partition(index=index, deep=deep) |
| 4211 | assert_eq(expected, result, check_index=False) |
| 4212 | |
| 4213 | # Series.memory_usage_per_partition |
| 4214 | expected = pd.Series( |
| 4215 | part.x.compute().memory_usage(index=index, deep=deep) for part in ddf.partitions |
| 4216 | ) |
| 4217 | result = ddf.x.memory_usage_per_partition(index=index, deep=deep) |
| 4218 | assert_eq(expected, result, check_index=False) |
| 4219 | |
| 4220 | |
| 4221 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected