| 138 | |
| 139 | |
| 140 | def test_map_index(): |
| 141 | df = pd.DataFrame({"x": [1, 2, 3, 4, 5]}) |
| 142 | ddf = dd.from_pandas(df, npartitions=2) |
| 143 | assert ddf.known_divisions is True |
| 144 | with pytest.warns(UserWarning, match="meta"): |
| 145 | cleared = ddf.index.map(lambda x: x * 10) |
| 146 | assert cleared.known_divisions is False |
| 147 | |
| 148 | with pytest.warns(UserWarning, match="meta"): |
| 149 | applied = ddf.index.map(lambda x: x * 10, is_monotonic=True) |
| 150 | assert applied.known_divisions is True |
| 151 | assert applied.divisions == tuple(x * 10 for x in ddf.divisions) |
| 152 | |
| 153 | |
| 154 | @pytest.mark.xfail( |