<?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 Pandas Styler and Borders in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/pandas-styler-and-borders/m-p/1279042#M67427</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to add borders to specific cells and when adjacent, border the group without internal borders.&amp;nbsp; Here is my code so far...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd

df = pd.DataFrame({"TransNo":[29, 32, 34, 45, 68, 71, 72, 73, 81],
                    "Type":["Fee", "Sale", "Fee", "Fee", "Sale", "Sale", "Sale", "Sale", "Fee"],
                  "Amount": [1.2, 10.2, 2.1, 3.1, 15.3, 19.2, 100.5, 97.3, 2.2]})

def border(cell_value):
    if cell_value == "Sale":
        return "border: solid thin"
    
df.style.applymap(border)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and here is the output...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TylerT_0-1681583278221.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68100i3AC7A4B4D7CB30F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TylerT_0-1681583278221.png" alt="TylerT_0-1681583278221.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and here is the markup of the desired output....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TylerT_1-1681583415694.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68101iDB0B26C05C0F7E01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TylerT_1-1681583415694.png" alt="TylerT_1-1681583415694.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The red markup indicating the deletion of internal lines.&amp;nbsp; Any pointers would be appreciated.&amp;nbsp; Thank you.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tyler&lt;/P&gt;</description>
    <pubDate>Sat, 15 Apr 2023 21:31:49 GMT</pubDate>
    <dc:creator>TylerT</dc:creator>
    <dc:date>2023-04-15T21:31:49Z</dc:date>
    <item>
      <title>Pandas Styler and Borders</title>
      <link>https://community.esri.com/t5/python-questions/pandas-styler-and-borders/m-p/1279042#M67427</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to add borders to specific cells and when adjacent, border the group without internal borders.&amp;nbsp; Here is my code so far...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd

df = pd.DataFrame({"TransNo":[29, 32, 34, 45, 68, 71, 72, 73, 81],
                    "Type":["Fee", "Sale", "Fee", "Fee", "Sale", "Sale", "Sale", "Sale", "Fee"],
                  "Amount": [1.2, 10.2, 2.1, 3.1, 15.3, 19.2, 100.5, 97.3, 2.2]})

def border(cell_value):
    if cell_value == "Sale":
        return "border: solid thin"
    
df.style.applymap(border)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and here is the output...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TylerT_0-1681583278221.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68100i3AC7A4B4D7CB30F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TylerT_0-1681583278221.png" alt="TylerT_0-1681583278221.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and here is the markup of the desired output....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TylerT_1-1681583415694.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68101iDB0B26C05C0F7E01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TylerT_1-1681583415694.png" alt="TylerT_1-1681583415694.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The red markup indicating the deletion of internal lines.&amp;nbsp; Any pointers would be appreciated.&amp;nbsp; Thank you.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tyler&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2023 21:31:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pandas-styler-and-borders/m-p/1279042#M67427</guid>
      <dc:creator>TylerT</dc:creator>
      <dc:date>2023-04-15T21:31:49Z</dc:date>
    </item>
  </channel>
</rss>

