kosiew opened a new pull request, #1019:
URL: https://github.com/apache/datafusion-python/pull/1019

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   Closes #922.
   
    # Rationale for this change
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.  
   -->
   
   DataFusion currently lacks built-in methods for handling missing values 
(nulls and NaNs) in DataFrames. This functionality is commonly needed in data 
processing workflows and is available in other DataFrame libraries like pandas 
and PySpark.
   
   The changes add:
   - `fill_null()` method to replace NULL values with a specified value
   - `fill_nan()` method to replace NaN values with a numeric value in 
floating-point columns
   
   # What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   1. Added `fill_null()` method to DataFrame class:
      - Replaces NULL values with a specified value
      - Handles type casting validation
      - Allows filling specific columns or entire DataFrame
      - Preserves columns where casting fails
   
   2. Added `fill_nan()` method to DataFrame class:
      - Replaces NaN values with numeric values
      - Only operates on floating-point columns
      - Validates input types and column types
      - Allows filling specific columns or all numeric columns
   
   3. Added comprehensive test cases for both methods covering:
      - Different data types
      - Column subsetting
      - Type validation
      - Error cases
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   Yes, two new public methods are added to the DataFrame class:
   ```python
   # Fill nulls with a value
   df = df.fill_null(0)  # Fill all nulls with 0 where possible
   df = df.fill_null("missing", subset=["name"])  # Fill specific columns
   
   # Fill NaN values in numeric columns
   df = df.fill_nan(0)  # Fill all NaNs with 0
   df = df.fill_nan(99.9, subset=["price"])  # Fill specific columns
   ```
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to