Commit 13e44f7
[SPARK-55988][PS][TESTS] Compare categorical index codes by values in tests
### What changes were proposed in this pull request?
This PR updates `pyspark.pandas.tests.indexes.test_category` to compare categorical index `codes` by values instead of wrapping pandas `codes` with `pd.Index(...)`.
The test now compares `psidx.codes.to_numpy()` against `pidx.codes`.
### Why are the changes needed?
`CategoricalIndex.codes` on the pandas side is an ndarray-like result. Wrapping it with `pd.Index(...)` makes the test depend on pandas index materialization details rather than the categorical code values themselves.
Comparing the raw codes is a closer match to the pandas API shape and avoids depending on pandas index container behavior that differs in pandas 3.
### Does this PR introduce _any_ user-facing change?
No.
This PR only updates test expectations.
### How was this patch tested?
```bash
./python/run-tests.py --testnames pyspark.pandas.tests.indexes.test_category
```
This test passed locally in both pandas 3.0.0 and pandas 2.3.3 environments.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex GPT-5
Closes #54788 from ueshin/issues/SPARK-55988/category.
Authored-by: Takuya Ueshin <ueshin@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>1 parent 47424a3 commit 13e44f7
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
0 commit comments