You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ueshin (via GitHub)" <gi...@apache.org> on 2026/03/19 18:51:35 UTC
[PR] [SPARK-56080][PS] Align Series.argmax/argmin with pandas 3.0 NA handling [spark]
ueshin opened a new pull request, #54907:
URL: https://github.com/apache/spark/pull/54907
### What changes were proposed in this pull request?
This PR updates pandas-on-Spark `Series.argmax` and `Series.argmin` to match pandas 3.0 behavior for NA handling.
In `python/pyspark/pandas/series.py`, when an NA value is encountered with `skipna=False` or the Series is all-NA, pandas-on-Spark now raises `ValueError("Encountered an NA value with skipna=False")` for pandas 3.0 and later. For pandas versions earlier than 3.0, the existing deprecated behavior is preserved and still returns `-1` with a `FutureWarning`.
The related tests in `python/pyspark/pandas/tests/series/test_arg_ops.py` were updated so the expected behavior depends on the pandas version in use.
### Why are the changes needed?
pandas-on-Spark should remain consistent with pandas behavior.
pandas 3.0 changed `Series.argmax` and `Series.argmin` so NA cases with `skipna=False`, as well as all-NA cases, raise `ValueError` instead of following the previous deprecated return path. Without this change, pandas-on-Spark behaves differently from pandas 3.0+ in these cases.
### Does this PR introduce _any_ user-facing change?
Yes.
For pandas 3.0 and later, `pyspark.pandas.Series.argmax` and `pyspark.pandas.Series.argmin` now raise `ValueError("Encountered an NA value with skipna=False")` when NA values are present with `skipna=False`, or when the Series is all-NA.
For pandas versions earlier than 3.0, the existing behavior is unchanged.
### How was this patch tested?
Updated the related tests.
### Was this patch authored or co-authored using generative AI tooling?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-56080][PS] Align Series.argmax/argmin with pandas 3.0 NA handling [spark]
Posted by "ueshin (via GitHub)" <gi...@apache.org>.
ueshin commented on PR #54907:
URL: https://github.com/apache/spark/pull/54907#issuecomment-4092537288
cc @gaogaotiantian @HyukjinKwon @zhengruifeng
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-56080][PS] Align Series.argmax/argmin with pandas 3.0 NA handling [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #54907:
URL: https://github.com/apache/spark/pull/54907#issuecomment-4094106661
Merged to master.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-56080][PS] Align Series.argmax/argmin with pandas 3.0 NA handling [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon closed pull request #54907: [SPARK-56080][PS] Align Series.argmax/argmin with pandas 3.0 NA handling
URL: https://github.com/apache/spark/pull/54907
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org