(gpu)
| 4299 | |
| 4300 | @pytest.mark.parametrize("gpu", [False, pytest.param(True, marks=pytest.mark.gpu)]) |
| 4301 | def test_to_datetime(gpu): |
| 4302 | xd = pd if not gpu else pytest.importorskip("cudf") |
| 4303 | |
| 4304 | # meta dtype is inconsistent for cuDF-backed frames |
| 4305 | check_dtype = not gpu |
| 4306 | |
| 4307 | df = xd.DataFrame({"year": [2015, 2016], "month": ["2", "3"], "day": [4, 5]}) |
| 4308 | df.index.name = "ix" |
| 4309 | ddf = dd.from_pandas(df, npartitions=2) |
| 4310 | |
| 4311 | assert_eq(xd.to_datetime(df), dd.to_datetime(ddf), check_dtype=check_dtype) |
| 4312 | assert_eq(xd.to_datetime(df), dd.to_datetime(df), check_dtype=check_dtype) |
| 4313 | |
| 4314 | s = xd.Series( |
| 4315 | ["3/11/2000", "3/12/2000", "3/13/2000"] * 100, |
| 4316 | index=["3/11/2000", "3/12/2000", "3/13/2000"] * 100, |
| 4317 | ) |
| 4318 | ds = dd.from_pandas(s, npartitions=10, sort=False) |
| 4319 | |
| 4320 | # cuDF does not yet support timezone-aware datetimes |
| 4321 | if not gpu: |
| 4322 | assert_eq( |
| 4323 | xd.to_datetime(s, utc=True), |
| 4324 | dd.to_datetime(ds, utc=True), |
| 4325 | ) |
| 4326 | assert_eq( |
| 4327 | xd.to_datetime(s, utc=True), |
| 4328 | dd.to_datetime(s, utc=True), |
| 4329 | ) |
| 4330 | |
| 4331 | for arg in ("2021-08-03", 2021, s.index): |
| 4332 | with pytest.raises(NotImplementedError, match="non-index-able arguments"): |
| 4333 | dd.to_datetime(arg) |
| 4334 | |
| 4335 | |
| 4336 | @pytest.mark.xfail( |
nothing calls this directly
no test coverage detected