<?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: Changing a Field's Data Type in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490798#M10164</link>
    <description>&lt;P&gt;The problem here is that operation doesn't happen in-place. So, you have to do this to bake into the dataframe:&lt;/P&gt;&lt;PRE&gt;sdf = sdf.astype({'&lt;SPAN&gt;facility_id&lt;/SPAN&gt;': '&lt;SPAN&gt;Int64&lt;/SPAN&gt;'})&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may also use this syntax if you find it less confusing:&lt;/P&gt;&lt;PRE&gt;sdf["&lt;SPAN&gt;facility_id&lt;/SPAN&gt;"] = sdf["&lt;SPAN&gt;facility_id&lt;/SPAN&gt;"].astype("&lt;SPAN&gt;Int64&lt;/SPAN&gt;")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 17:05:53 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2024-06-12T17:05:53Z</dc:date>
    <item>
      <title>Changing a Field's Data Type</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490728#M10163</link>
      <description>&lt;P&gt;I'm working with spatially enabled dataframes (sdf) to develop a workflow using ArcGIS API for Python. In the sdf, I have a field name, &lt;EM&gt;facility_id&lt;/EM&gt;, which has a field type, Float64. I've changed the field type to Int64. When I print a list of field types, &lt;EM&gt;facility_id&lt;/EM&gt; has the old field type, Float64. See attached image to view outputs.&amp;nbsp; Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;# Change field type&lt;BR /&gt;sdf.astype({'facility_id': 'Int64'}).dtypes&lt;/P&gt;&lt;P&gt;# list field types by field name&lt;BR /&gt;sdf.dtypes&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 16:24:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490728#M10163</guid>
      <dc:creator>John_Herrera</dc:creator>
      <dc:date>2024-06-12T16:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a Field's Data Type</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490798#M10164</link>
      <description>&lt;P&gt;The problem here is that operation doesn't happen in-place. So, you have to do this to bake into the dataframe:&lt;/P&gt;&lt;PRE&gt;sdf = sdf.astype({'&lt;SPAN&gt;facility_id&lt;/SPAN&gt;': '&lt;SPAN&gt;Int64&lt;/SPAN&gt;'})&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may also use this syntax if you find it less confusing:&lt;/P&gt;&lt;PRE&gt;sdf["&lt;SPAN&gt;facility_id&lt;/SPAN&gt;"] = sdf["&lt;SPAN&gt;facility_id&lt;/SPAN&gt;"].astype("&lt;SPAN&gt;Int64&lt;/SPAN&gt;")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 17:05:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490798#M10164</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-06-12T17:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a Field's Data Type</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490816#M10166</link>
      <description>&lt;P&gt;The second piece of code works perfectly!&amp;nbsp; Thank you for time.&amp;nbsp; It's greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 17:29:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/changing-a-field-s-data-type/m-p/1490816#M10166</guid>
      <dc:creator>John_Herrera</dc:creator>
      <dc:date>2024-06-12T17:29:59Z</dc:date>
    </item>
  </channel>
</rss>

