<?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: PythonException: TypeError: float() argument must be a string or a number, not 'NoneType' in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37192#M26283</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/58899"&gt;@kll&lt;/a&gt;&amp;nbsp;- can you please try using try/catch option to convert None to an unique value for the decimal columns.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2023 21:49:01 GMT</pubDate>
    <dc:creator>shan_chandra</dc:creator>
    <dc:date>2023-07-07T21:49:01Z</dc:date>
    <item>
      <title>PythonException: TypeError: float() argument must be a string or a number, not 'NoneType'</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37180#M26280</link>
      <description>&lt;P class=""&gt;I get an PythonException:&amp;nbsp;float() argument must be a string or a number, not 'NoneType' when attempting to save a DataFrame as a Delta Table.&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Here's the line of code that I am running:&lt;/P&gt;&lt;P class=""&gt;```&lt;/P&gt;&lt;P class=""&gt;df.write.format("delta").saveAsTable("schema1.df_table", mode="overwrite")&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;root &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- ts: timestamp (nullable = true) &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- _source: string (nullable = true)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- lat: decimal(9,6) (nullable = true) &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- lng: decimal(9,6) (nullable = true)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- id: string (nullable = false) &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- mm-yyyy: date (nullable = true) &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;|-- hid: string (nullable = true)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;```&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;PythonException: An exception was thrown from the Python worker. Please see the stack trace below. 'TypeError: float() argument must be a string or a number, not 'NoneType'', from , line 3. Full traceback below: Traceback (most recent call last): File "", line 3, in TypeError: float() argument must be a string or a number, not 'NoneType'&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;How do we handle `None` in the spark DataFrame? I'd like to identify which rows / columns contain `None` and drop them?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 18:13:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37180#M26280</guid>
      <dc:creator>kll</dc:creator>
      <dc:date>2023-07-07T18:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: TypeError: float() argument must be a string or a number, not 'NoneType'</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37192#M26283</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/58899"&gt;@kll&lt;/a&gt;&amp;nbsp;- can you please try using try/catch option to convert None to an unique value for the decimal columns.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 21:49:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37192#M26283</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2023-07-07T21:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: TypeError: float() argument must be a string or a number, not 'NoneType'</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37193#M26284</link>
      <description>&lt;P&gt;something like the below&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;try:
if lng is not None:
new_lng = lng
else:
new_lng = 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 21:49:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37193#M26284</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2023-07-07T21:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: TypeError: float() argument must be a string or a number, not 'NoneType'</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37462#M26364</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/58899"&gt;@kll&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope you are well. Just wanted to see if you were able to find an answer to your question and would you like to mark an answer as best? It would be really helpful for the other members too.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 09:07:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37462#M26364</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-12T09:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: PythonException: TypeError: float() argument must be a string or a number, not 'NoneType'</title>
      <link>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37582#M26390</link>
      <description>&lt;P&gt;Even though the code throws the issue while write, the issue can be in the code before as spark is lazily evaluated. The error "&lt;SPAN&gt;TypeError: float() argument must be a string or a number, not 'NoneType'&lt;/SPAN&gt;" generally comes when we pass a variable to float() function and the value of the variable at that time is None. I would recommend you to check for such issues.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 16:30:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pythonexception-typeerror-float-argument-must-be-a-string-or-a/m-p/37582#M26390</guid>
      <dc:creator>Lakshay</dc:creator>
      <dc:date>2023-07-13T16:30:37Z</dc:date>
    </item>
  </channel>
</rss>

