<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: unable to replace null with 0 in dataframe using Pyspark databricks notebook (community edition) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unable-to-replace-null-with-0-in-dataframe-using-pyspark/m-p/29591#M21314</link>
    <description>&lt;P&gt;I bet that it is not real null but the string "null". Please check what is in the source and try luck with replacing it.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 19:44:45 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2022-10-03T19:44:45Z</dc:date>
    <item>
      <title>unable to replace null with 0 in dataframe using Pyspark databricks notebook (community edition)</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-replace-null-with-0-in-dataframe-using-pyspark/m-p/29590#M21313</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am unable to replace nulls with 0 in a dataframe ,please refer to the screen shot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from pyspark.sql.functions import col
emp_csv_df = emp_csv_df.na.fill(0).withColumn("Total_Sal",col('sal')+col('comm'))
display(emp_csv_df)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;erorr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="unable to fill nulls with 0 in dataframe using PySpark in databricks"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1412i9619CFA7B7F6A394/image-size/large?v=v2&amp;amp;px=999" role="button" title="unable to fill nulls with 0 in dataframe using PySpark in databricks" alt="unable to fill nulls with 0 in dataframe using PySpark in databricks" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desired output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screenshot 2022-10-03 at 20.26.23"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1421i5C390980620E88F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-10-03 at 20.26.23" alt="Screenshot 2022-10-03 at 20.26.23" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any suggestions ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rakesh&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 14:58:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-replace-null-with-0-in-dataframe-using-pyspark/m-p/29590#M21313</guid>
      <dc:creator>db-avengers2rul</dc:creator>
      <dc:date>2022-10-03T14:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: unable to replace null with 0 in dataframe using Pyspark databricks notebook (community edition)</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-replace-null-with-0-in-dataframe-using-pyspark/m-p/29591#M21314</link>
      <description>&lt;P&gt;I bet that it is not real null but the string "null". Please check what is in the source and try luck with replacing it.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 19:44:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-replace-null-with-0-in-dataframe-using-pyspark/m-p/29591#M21314</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-03T19:44:45Z</dc:date>
    </item>
  </channel>
</rss>

