ramesh004 commented on PR #60013:
URL: https://github.com/apache/spark/pull/60013#issuecomment-6896563914
> ## What changes were proposed in this pull request?
> This PR adds support for passing a pandas-on-Spark `Series` as the `value`
argument to `Series.fillna`.
>
> When the replacement `Series` comes from the same DataFrame, missing
values in the target Series are filled using the corresponding values from the
replacement Series.
>
> For example:
>
> ```python
> df = ps.DataFrame({"c0": [None], "c1": [1.0]})
> result = df["c0"].fillna(df["c1"])
> ```
>
> The result now matches pandas and contains `1.0` instead of raising an
unsupported-type error.
>
> The PR also adds regression coverage for filling a pandas-on-Spark Series
with another aligned Series.
>
> ## Why are the changes needed?
> Previously, pandas-on-Spark rejected a `Series` passed to `Series.fillna`
and raised:
>
> ```
> TypeError: Unsupported type Series
> ```
>
> Pandas supports this operation by aligning the replacement Series with the
target Series and filling each missing value with the corresponding value.
>
> The change is needed to improve pandas API compatibility and allow users
to fill missing values from another column of the same DataFrame.
>
> ## Does this PR introduce any user-facing change?
> Yes.
>
> Users can now pass a pandas-on-Spark `Series` to `Series.fillna` when the
Series belongs to the same DataFrame.
>
> Previously, this operation raised a `TypeError`. After the change, it
returns a filled Series consistent with pandas behavior.
>
> ## How was this patch tested?
> Regression tests were added for `Series.fillna` with another Series as the
replacement value.
>
> The tests verify that:
>
> * A missing floating-point value is filled from the corresponding value in
another Series.
> * The returned values match pandas.
> * The resulting Series retains the expected name and data type.
> * Existing scalar-based `fillna` behavior continues to work.
>
> Add the exact test command and result here after running the relevant
pandas-on-Spark test suite.
>
> ## Was this patch authored or co-authored using generative AI tooling?
> Yes.
>
> Generative AI tooling was used to help analyze the issue and prepare the
pull-request description.
>
Claude copilot
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]