Repository: dask/dask

Issue:
"Order of columns does not match" error should give an extra info about expected order
It is not clear what order we should provide when we see the error "Order of columns does not match":
```python
import pandas as pd
import dask.dataframe as dd

data = {
    'id': [1, 1, 1, 2, 2, 2],
    'date': pd.to_datetime(['2023-01-01', '2023-01-04', '2023-01-05', '2023-01-01', '2023-01-04', '2023-01-05']),
    'metric': [1,1,1,1,1,1]
}
pd_df = pd.DataFrame(data).astype({'id': 'int64', 'metric': 'int64', 'date': 'datetime64[ns]'})
df = dd.from_pandas(pd_df)

df = (
    df
    .groupby(by=['id'])
    .apply(lambda x: x.resample("D", on="date").sum().reset_index(), include_groups=True, meta={"metric": "int64", 'date': 'datetime64[ns]', 'id': 'int64'})
    .reset_index(drop=True)
)
display(df.dtypes)
display(df.compute())
```

The right order is:
```
meta={'date': 'datetime64[ns]', 'id': 'int64', "metric": "int64", }
```
but it isn't clear why

https://github.com/dask/dask/blob/e71d4361a57e7990e4a325021e6382877ac9ab49/dask/dataframe/utils.py#L437

Discussion:
GPUtester: Can one of the admins verify this patch?

Admins can comment `ok to test` to allow this one PR to run or `add to allowlist` to allow all future PRs from the same author to run.
github-actions[bot]: ## Unit Test Results
_See [test report](https://dask.github.io/dask/test_report.html) for an extended history of previous test failures. This is useful for diagnosing flaky tests._

     13 files  ±0       13 suites  ±0   3h 14m 17s :stopwatch: + 7m 59s
 13 213 tests ±0   12 156 :white_check_mark:  - 1   1 056 :zzz: ±0   1 :x: + 1 
137 811 runs  ±0  118 775 :white_check_mark:  - 5  19 026 :zzz:  - 5  10 :x: +10 

For more details on these failures, see [this check](https://github.com/dask/dask/runs/30270247992).

Results for commit 13d19bc9. ± Comparison against base commit e71d4361.

[test-results]:data:application/gzip;base64,H4sIAE6u6WYC/1XMSQ7DIAyF4atErLuImellKkqwhJqhIrCKevdCxnb5Plv/QjD0fib3BtitIXMO6VpdjjaFaawbpFCFyjVtd7q+rPsxZ+cqUhDywld4V2x/DG3oq53gY5xikbZIzOOWVhpg32catFLixD1tWioPO9JH6S/tpmEIqQwCrAPzdEYZqazXHFB4LZhF7zgY7DTngjJE8vkCCvGLERsBAAA=


Patch:
diff --git a/.github/workflows/update-gpuci.yml b/.github/workflows/update-gpuci.yml
index b657cb091..bb8c55456 100644
--- a/.github/workflows/update-gpuci.yml
+++ b/.github/workflows/update-gpuci.yml
@@ -21,7 +21,7 @@ jobs:
 
       - name: Get latest cuDF nightly version
         id: cudf_latest
-        uses: jacobtomlinson/gha-anaconda-package-version@0.1.3
+        uses: jacobtomlinson/gha-anaconda-package-version@0.1.4
         with:
           org: "rapidsai-nightly"
           package: "cudf"
@@ -29,7 +29,7 @@ jobs:
 
       - name: Get latest UCX-Py nightly version
         id: ucx_py_latest
-        uses: jacobtomlinson/gha-anaconda-package-version@0.1.3
+        uses: jacobtomlinson/gha-anaconda-package-version@0.1.4
         with:
           org: "rapidsai-nightly"
           package: "ucx-py"
diff --git a/continuous_integration/gpuci/axis.yaml b/continuous_integration/gpuci/axis.yaml
index 7b30d5065..41fca92d9 100644
--- a/continuous_integration/gpuci/axis.yaml
+++ b/continuous_integration/gpuci/axis.yaml
@@ -9,6 +9,6 @@ LINUX_VER:
 - ubuntu20.04
 
 RAPIDS_VER:
-- "24.10"
+- "24.12"
 
 excludes:
diff --git a/dask/dataframe/utils.py b/dask/dataframe/utils.py
index d748db315..456843efb 100644
--- a/dask/dataframe/utils.py
+++ b/dask/dataframe/utils.py
@@ -434,10 +434,14 @@ def check_matching_columns(meta, actual):
         if extra or missing:
             extra_info = f"  Extra:   {extra}\n  Missing: {missing}"
         else:
-            extra_info = "Order of columns does not match"
+            extra_info = (
+                f"Order of columns does not match."
+                f"\nActual:   {actual.columns.tolist()}"
+                f"\nExpected: {meta.columns.tolist()}"
+            )
         raise ValueError(
             "The columns in the computed data do not match"
-            " the columns in the provided metadata\n"
+            " the columns in the provided metadata.\n"
             f"{extra_info}"
         )
 


Test patch:
diff --git a/dask/dataframe/tests/test_utils_dataframe.py b/dask/dataframe/tests/test_utils_dataframe.py
index 40dc3bbce..6b0af9935 100644
--- a/dask/dataframe/tests/test_utils_dataframe.py
+++ b/dask/dataframe/tests/test_utils_dataframe.py
@@ -463,7 +463,12 @@ def test_check_matching_columns_raises_appropriate_errors():
     df = pd.DataFrame(columns=["a", "b", "c"])
 
     meta = pd.DataFrame(columns=["b", "a", "c"])
-    with pytest.raises(ValueError, match="Order of columns does not match"):
+    with pytest.raises(
+        ValueError,
+        match="Order of columns does not match."
+        "\nActual:   \\['a', 'b', 'c'\\]"
+        "\nExpected: \\['b', 'a', 'c'\\]",
+    ):
         assert check_matching_columns(meta, df)
 
     meta = pd.DataFrame(columns=["a", "b", "c", "d"])