<?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: how to change number format in python with code bloc in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362016#M69435</link>
    <description>&lt;P&gt;If you want to programmatically set the number format of a field, I don't think you can do that with Python.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 15:17:12 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2023-12-18T15:17:12Z</dc:date>
    <item>
      <title>how to change number format in python with code bloc</title>
      <link>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362001#M69433</link>
      <description>&lt;P&gt;I would like to change my number format to percentage. I know I can make this in fields pane, but I wanna try to solve it in code bloc through "Calculate Field".&lt;/P&gt;&lt;P&gt;Image 1:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CeciliaMalvezzi_0-1702910296881.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/89347iA6C80149132BCAC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CeciliaMalvezzi_0-1702910296881.png" alt="CeciliaMalvezzi_0-1702910296881.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It's in this format that I wanna set, but in python in code bloc.&lt;/P&gt;&lt;P&gt;Many Thanks!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 14:39:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362001#M69433</guid>
      <dc:creator>CeciliaMalvezzi</dc:creator>
      <dc:date>2023-12-18T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to change number format in python with code bloc</title>
      <link>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362010#M69434</link>
      <description>&lt;P&gt;Are you asking how to taking a number like 0.123 (12.3%) and make it 12.3?&amp;nbsp; If so, just multiply the current value by 100; otherwise, I am not sure what you are asking.&amp;nbsp; The numeric field will never store the percent sign, that is simply a formatting option in a table view.&amp;nbsp; If you want a percent sign with the actual data, you will have to use a string field.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 15:07:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362010#M69434</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2023-12-18T15:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to change number format in python with code bloc</title>
      <link>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362016#M69435</link>
      <description>&lt;P&gt;If you want to programmatically set the number format of a field, I don't think you can do that with Python.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 15:17:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362016#M69435</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2023-12-18T15:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to change number format in python with code bloc</title>
      <link>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362082#M69436</link>
      <description>&lt;P&gt;I would like to transform the number "27" into "27%". The way that I know, is to going on field pane and changing "number format" to percentage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Going in this string field idea, how do I concatenate the symbol "%" into my code bloc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CeciliaMalvezzi_0-1702918159618.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/89362iB15415BD4741CAA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CeciliaMalvezzi_0-1702918159618.png" alt="CeciliaMalvezzi_0-1702918159618.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This scrip in code bloc helps me to get percentage value. If I wanna concatenate an "%" symbol, do I need to write "return round(X,0) + "%"".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm asking cus when I made it, it acuses me error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 16:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362082#M69436</guid>
      <dc:creator>CeciliaMalvezzi</dc:creator>
      <dc:date>2023-12-18T16:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to change number format in python with code bloc</title>
      <link>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362783#M69454</link>
      <description>&lt;P&gt;Python has very robust string formatting you can use and it won't require a code block.&amp;nbsp; For the expression, try:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"{:.0%}".format(!condicao!/!total!)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Dec 2023 20:03:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-change-number-format-in-python-with-code/m-p/1362783#M69454</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2023-12-19T20:03:49Z</dc:date>
    </item>
  </channel>
</rss>

