<?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 Error of &amp;quot;name 'IntegerType' is not defined&amp;quot; in attempting to convert a DF column to IntegerType in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27169#M19049</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;initialDF .withColumn("OriginalCol", initialDF.OriginalCol.cast(&lt;B&gt;IntegerType&lt;/B&gt;))&lt;/P&gt;
&lt;P&gt;Or &lt;/P&gt;
&lt;P&gt;initialDF .withColumn("OriginalCol", initialDF.OriginalCol.cast(&lt;B&gt;IntegerType()&lt;/B&gt;))&lt;/P&gt;
&lt;P&gt;However, always failed with this error : &lt;/P&gt;
&lt;P&gt;NameError: name 'IntegerType' is not defined&lt;/P&gt;
&lt;P&gt;Any help is appreciated. &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 24 May 2020 05:00:55 GMT</pubDate>
    <dc:creator>BingQian</dc:creator>
    <dc:date>2020-05-24T05:00:55Z</dc:date>
    <item>
      <title>Error of "name 'IntegerType' is not defined" in attempting to convert a DF column to IntegerType</title>
      <link>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27169#M19049</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;initialDF .withColumn("OriginalCol", initialDF.OriginalCol.cast(&lt;B&gt;IntegerType&lt;/B&gt;))&lt;/P&gt;
&lt;P&gt;Or &lt;/P&gt;
&lt;P&gt;initialDF .withColumn("OriginalCol", initialDF.OriginalCol.cast(&lt;B&gt;IntegerType()&lt;/B&gt;))&lt;/P&gt;
&lt;P&gt;However, always failed with this error : &lt;/P&gt;
&lt;P&gt;NameError: name 'IntegerType' is not defined&lt;/P&gt;
&lt;P&gt;Any help is appreciated. &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 05:00:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27169#M19049</guid>
      <dc:creator>BingQian</dc:creator>
      <dc:date>2020-05-24T05:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error of "name 'IntegerType' is not defined" in attempting to convert a DF column to IntegerType</title>
      <link>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27170#M19050</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I'm assuming you are using Python.&lt;/P&gt;
&lt;P&gt;In order to use the IntegerType, you first have to import it with the following statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;from pyspark.sql.types import IntegerType&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you plan to have various conversions, it will make sense to import all types. This can be done as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;from pyspark.sql.types import *&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For further reference, you can check the Spark documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://spark.apache.org/docs/latest/sql-reference.html" target="test_blank"&gt;https://spark.apache.org/docs/latest/sql-reference.html&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 21:03:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27170#M19050</guid>
      <dc:creator>KristoRaun</dc:creator>
      <dc:date>2020-05-24T21:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error of "name 'IntegerType' is not defined" in attempting to convert a DF column to IntegerType</title>
      <link>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27171#M19051</link>
      <description>&lt;P&gt;Thank you @Kristo Raun​&amp;nbsp; !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 01:50:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-of-quot-name-integertype-is-not-defined-quot-in-attempting/m-p/27171#M19051</guid>
      <dc:creator>BingQian</dc:creator>
      <dc:date>2020-05-25T01:50:09Z</dc:date>
    </item>
  </channel>
</rss>

