<?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: Simple table in Label Expression in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1270561#M67042</link>
    <description>&lt;P&gt;Labels only show strings, s you have to return a string.&lt;/P&gt;&lt;P&gt;I can' test right now, maybe it works with the DataFrame method:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel():
    table = getTable()
    return table.to_string()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it doesn't, you can try constructing it yourself (untested):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel():
    d = {"DATE": ["Fall 2018", "Spring 2019"], "RESULTS": [7.1, 8.4]}
    # get the column names and the max row count
    columns = k in d.keys()
    num_rows = max([len(d[c]) for c in columns])
    # header in bold
    rows = [
        "\t".join([f"&amp;lt;BOL&amp;gt;{c}&amp;lt;/BOL&amp;gt;" for c in columns]),
    ]
    # append the values
    for r in range(num_rows):
        row = []
        for c in columns:
            # get the value of current r and c, or default empty string
            try:
                row.append(str(d[c][r]))
            except IndexError:
                row.append(" ")
        rows.append("\t".join(row))
    # concatenate the rows with line breaks
    return "\n".join(rows)
        &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2023 18:48:08 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-03-22T18:48:08Z</dc:date>
    <item>
      <title>Simple table in Label Expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1270063#M66991</link>
      <description>&lt;P&gt;I want to create simple tables in my labels. I thought that using python and pandas dataframe might work, but although the&amp;nbsp;expression verifies as valid, no labels appear on my map. Is there a different way to accomplish this either in Python or a different language? I am using ArcPro 3.1. Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EmmaO_0-1679428880694.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65849i7B6B40720008D385/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EmmaO_0-1679428880694.png" alt="EmmaO_0-1679428880694.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 20:08:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1270063#M66991</guid>
      <dc:creator>EmmaO</dc:creator>
      <dc:date>2023-03-21T20:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple table in Label Expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1270561#M67042</link>
      <description>&lt;P&gt;Labels only show strings, s you have to return a string.&lt;/P&gt;&lt;P&gt;I can' test right now, maybe it works with the DataFrame method:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel():
    table = getTable()
    return table.to_string()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it doesn't, you can try constructing it yourself (untested):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel():
    d = {"DATE": ["Fall 2018", "Spring 2019"], "RESULTS": [7.1, 8.4]}
    # get the column names and the max row count
    columns = k in d.keys()
    num_rows = max([len(d[c]) for c in columns])
    # header in bold
    rows = [
        "\t".join([f"&amp;lt;BOL&amp;gt;{c}&amp;lt;/BOL&amp;gt;" for c in columns]),
    ]
    # append the values
    for r in range(num_rows):
        row = []
        for c in columns:
            # get the value of current r and c, or default empty string
            try:
                row.append(str(d[c][r]))
            except IndexError:
                row.append(" ")
        rows.append("\t".join(row))
    # concatenate the rows with line breaks
    return "\n".join(rows)
        &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1270561#M67042</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-22T18:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple table in Label Expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1272065#M67233</link>
      <description>&lt;P&gt;table.to_string() works! Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 18:22:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1272065#M67233</guid>
      <dc:creator>EmmaO</dc:creator>
      <dc:date>2023-03-27T18:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Simple table in Label Expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1274124#M67454</link>
      <description>&lt;P&gt;Can you post a screenshot for how the final product looks? I tried in arcgis pro 2.9.0 but its just text separated by spaces. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 15:19:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1274124#M67454</guid>
      <dc:creator>JeffreyFitzgibbons</dc:creator>
      <dc:date>2023-03-31T15:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Simple table in Label Expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1275049#M67563</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EmmaO_0-1680568454748.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/67146iC0EB33D812CA558F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EmmaO_0-1680568454748.png" alt="EmmaO_0-1680568454748.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is what it looks like in 3.1. I actually spoke a little too soon. I thought that using the methods &lt;A href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_string.html" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;I would be able to format it how I wanted, but having played around, I haven't been able to do so. It also would be nice if there were lines to format the table, but I'm not sure if that's possible.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 00:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/simple-table-in-label-expression/m-p/1275049#M67563</guid>
      <dc:creator>EmmaO</dc:creator>
      <dc:date>2023-04-04T00:48:42Z</dc:date>
    </item>
  </channel>
</rss>

