null replace with blank

Shambhu Rai 1,406 Reputation points
2022-09-02T05:50:06.59+00:00

Hi Expert,
how we can replace Null with Blank values in spark sql for all columns

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
1,941 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,609 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 31,061 Reputation points Microsoft Employee
    2022-09-02T06:41:44.887+00:00

    Hi @Shambhu Rai ,
    Thankyou for using Microsoft Q&A platform and thanks for posting your question here.

    You can use df.na.fill to achieve this requirement. In Spark, fill() function of DataFrameNaFunctions class is used to replace NULL values on the DataFrame column with either with zero(0), empty string, space, or any constant literal values.

    237164-image.png

    For more details, kindly visit : Spark Replace NULL Values on DataFrame

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators