<?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 remove a specific unique value with arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598327#M46805</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake,&lt;/P&gt;&lt;P&gt;in your code you work only with one layer. I want that arcpy will iterate all layers in all 50 mxd's. i have many other layers in the mxd's with different names that including value "residence a" in them.&lt;/P&gt;&lt;P&gt;To your opinion, i must change the layer name every time i want to work on specific layer- this will take a&amp;nbsp; lot of time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 May 2015 12:40:21 GMT</pubDate>
    <dc:creator>Yaron_YosefCohen</dc:creator>
    <dc:date>2015-05-11T12:40:21Z</dc:date>
    <item>
      <title>How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598322#M46800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;For &lt;SPAN style="color: #3e3e3e; font-family: Arial; font-size: 16px;"&gt;disclosure, i asked this question in &lt;A href="http://gis.stackexchange.com/questions/146257/how-to-remove-a-specific-unique-value-with-arcpy" title="http://gis.stackexchange.com/questions/146257/how-to-remove-a-specific-unique-value-with-arcpy" rel="nofollow noopener noreferrer" target="_blank"&gt;python - How to remove a specific unique value with arcpy - Geographic Information Systems Stack Exchange&lt;/A&gt; &lt;/SPAN&gt; but didn't get &lt;SPAN style="color: #3e3e3e; font-family: Arial; font-size: 16px;"&gt;useful answers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;using arcpy, i would like to remove from 50 mxd files, a specific unique value called "residence a" (exist in 3 layers) from the table of content.&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;IMG alt="enter image description here" class="jive-image" src="http://i.stack.imgur.com/u8puD.jpg" /&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;The value of "residence a" is the number&amp;nbsp; "70"&amp;nbsp; in the attribute table (in field named "YEUD")&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;IMG alt="enter image description here" class="jive-image" src="http://i.stack.imgur.com/XcTfr.jpg" /&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;When i use this code:&lt;CODE&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy,os,sys
from arcpy import env

env.workspace = r"C:\Project"
for mxdname in arcpy.ListFiles("*.mxd"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(r"C:\Project\\" + mxdname)
&amp;nbsp;&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxd, "*")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.symbologyType == "UNIQUE_VALUES":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vals = lyr.symbology.classLabels
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for v in vals:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if v == "residence a":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxdname
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("1 in layer " + lyr.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df, v)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()
del mxd&lt;/PRE&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;i get en error:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Project&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;-.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mxd mig1 &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #953838;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; layer mig1&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Traceback&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;most recent call last&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;):&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;File&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:/Users/yaron.KAYAMOT/Desktop/remove UNIQUE_VALUES in lyr.py"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; line &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #953838;"&gt;18&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;module&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;RemoveLayer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;df&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; v&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;File&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\utils.py"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; line &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #953838;"&gt;182&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; fn_ &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; fn&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;(*&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;args&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;**&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;kw&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;File&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\mapping.py"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; line &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #953838;"&gt;1845&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;RemoveLayer&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #8a4a0b;"&gt;assert&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; isinstance&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;remove_layer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;Layer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="color: #2b91af;"&gt;AssertionError&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #145680;"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; 
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I search desperately a solution to my problem -thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598322#M46800</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2021-12-12T01:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598323#M46801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the assertion error suggests that it is of the wrong type.&amp;nbsp; The way you have it set up 'v' is a class in classlabels.&amp;nbsp; You want to remove the layer apparently which I think is 'lyr' so I suspect if you want to remove the layer if it contains that label, then you should be using&amp;nbsp; arcpy.mapping.RemoveLayer(df, lyr) .&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 11:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598323#M46801</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-05-11T11:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598324#M46802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You aren't trying to remove the FC, just a value in the symbology, correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two simple options would be to either replace the layer file in each mxd with one excluding the the residence value and another option would be to apply&amp;nbsp; definition query to the FC and query out the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below will replace a layer file in a directory of mxd's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
import glob

folder = &amp;lt;folder containing mxds&amp;gt;
layerName = &amp;lt;Existing layer name in mxd's to be replaced&amp;gt;
layerFile = &amp;lt;Layer file containing new symbology&amp;gt;

newLayer = arcpy.mapping.Layer(layerFile)

mxds = glob.glob(folder + '\\' + '*.mxd')
arcpy.gp.overwriteOutput = True

for mxdFile in mxds:
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(mxdFile)
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name == layerName:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.UpdateLayer(df, lyr, newLayer, False)
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()
del mxd, newLayer&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598324#M46802</guid>
      <dc:creator>CarlSunderman</dc:creator>
      <dc:date>2021-12-12T01:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598325#M46803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but i don't want to remove layers mig 1 2 3 .i want to remove only value "residence a",so my TOC will be:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="1.jpg" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/98040_1.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 11:52:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598325#M46803</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-05-11T11:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598326#M46804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Y.Y.C,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can append the unique values to a list, remove the value you do not want to use, and then update the symbology.&amp;nbsp; Below is an example that removes the value 'Philadelphia International Airport' from a unique value list, and then updates the symbology.&amp;nbsp; Also, &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/uniquevaluessymbology-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;here &lt;/A&gt;is a helpful link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument("current")
lyr = arcpy.mapping.ListLayers(mxd, "Airports")[0]
airportList = []
rows = arcpy.da.SearchCursor(lyr, ["NAME"])
for row in rows:
&amp;nbsp; airportList.append(row[0])

#remove duplicates from list
airportList = dict.fromkeys(airportList)
airportList = airportList.keys()

#remove unique value
airportList.remove('Philadelphia International Airport')

#update symbology
if lyr.symbologyType == "UNIQUE_VALUES":
&amp;nbsp; lyr.symbology.classValues = airportList
&amp;nbsp; lyr.symbology.showOtherValues = False

arcpy.RefreshActiveView()
arcpy.RefreshTOC()
del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598326#M46804</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-12T01:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598327#M46805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake,&lt;/P&gt;&lt;P&gt;in your code you work only with one layer. I want that arcpy will iterate all layers in all 50 mxd's. i have many other layers in the mxd's with different names that including value "residence a" in them.&lt;/P&gt;&lt;P&gt;To your opinion, i must change the layer name every time i want to work on specific layer- this will take a&amp;nbsp; lot of time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 12:40:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598327#M46805</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-05-11T12:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598328#M46806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would just need to add a 'for' loop for the layers within your MXD.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy&amp;nbsp; 
mxd = arcpy.mapping.MapDocument("current")&amp;nbsp; 
lyrs = arcpy.mapping.ListLayers(mxd, "*")
for layer in lyrs:
&amp;nbsp; airportList = []&amp;nbsp; 
&amp;nbsp; rows = arcpy.da.SearchCursor(layer, ["NAME"])&amp;nbsp; 
&amp;nbsp; for row in rows:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList.append(row[0])&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; #remove duplicates from list&amp;nbsp; 
&amp;nbsp; airportList = dict.fromkeys(airportList)&amp;nbsp; 
&amp;nbsp; airportList = airportList.keys()&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; #remove unique value&amp;nbsp; 
&amp;nbsp; airportList.remove('Philadelphia International Airport')&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; #update symbology&amp;nbsp; 
&amp;nbsp; if layer.symbologyType == "UNIQUE_VALUES":&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer.symbology.classValues = airportList&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer.symbology.showOtherValues = False&amp;nbsp; 
&amp;nbsp; 
arcpy.RefreshActiveView()&amp;nbsp; 
arcpy.RefreshTOC()&amp;nbsp; 
del mxd &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598328#M46806</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-12T01:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598329#M46807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carl,&lt;/P&gt;&lt;P&gt;How&amp;nbsp; can i&amp;nbsp; &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;apply&amp;nbsp; definition query to the FC and query out the values in the code?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2015 05:36:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598329#M46807</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-05-12T05:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598330#M46808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for lyr in arcpy.mapping.ListLayers(mxd, "*"): 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name == "&amp;lt;Feature Name&amp;gt;": 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.definitionQuery = '&amp;lt;Field Name&amp;gt; = \'&amp;lt;Field Value&amp;gt;\''
mxd.save()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for a shapefile, the format is slightly different&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598330#M46808</guid>
      <dc:creator>CarlSunderman</dc:creator>
      <dc:date>2021-12-12T01:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598331#M46809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake,&lt;/P&gt;&lt;P&gt;I tried to build this code (i&amp;nbsp; also created shp called "Airports" with field "NAME" &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy,os,sys&amp;nbsp; 
from arcpy import env&amp;nbsp; 
&amp;nbsp; 
env.workspace = r"C:\Project\gis"&amp;nbsp; 
for mxdname in arcpy.ListFiles("*.mxd"):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(r"C:\Project\gis\\" + mxdname)&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrs = arcpy.mapping.ListLayers(mxd, "*") 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for layer in lyrs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList = []&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.da.SearchCursor(layer, ["NAME"])&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList.append(row[0])&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #remove duplicates from list&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList = dict.fromkeys(airportList)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList = airportList.keys()&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #remove unique value&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList.remove('Philadelphia International Airport')&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #update symbology&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if layer.symbologyType == "UNIQUE_VALUES":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer.symbology.classValues = airportList&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer.symbology.showOtherValues = False 

&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()&amp;nbsp; 
del mxd&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but get an error:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; ================================ RESTART ================================
=
&amp;gt;&amp;gt;&amp;gt; 


Traceback (most recent call last):
&amp;nbsp; File "C:\Users\yaron.KAYAMOT\Desktop\python.py", line 19, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList.remove('Philadelphia International Airport')
ValueError: list.remove(x): x not in list
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598331#M46809</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2021-12-12T01:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598332#M46810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;​it isn't in the list...or is spelled differently always test for existence and return an error warning&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to_remove = 'some airport'&lt;/P&gt;&lt;P&gt;if to_remove in airportList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; airportList.remove(to_remove)&lt;/P&gt;&lt;P&gt;else:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "not there bud..."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jun 2015 14:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598332#M46810</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-06-07T14:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598333#M46811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Python will not only modify the Unique Values listed in the layer, it will reset the symbology of every unique value in the list to random simple colors.&amp;nbsp; Python mapping is very limited in what it can do with symbols.&amp;nbsp; Therefore the picture you showed will never retain the symbol colors you showed if you use Python.&amp;nbsp; You would have to use .Net ArcObjects to maintain the rest of the symbols in the layer after removing one of the values from the list.&amp;nbsp; I am afraid you are wasting your time with Python if you require the symbols for the other Unique Values to remain unchanged.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jun 2015 15:08:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598333#M46811</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-06-07T15:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598334#M46812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i just want to remove the value "residence a" from the layers. Right now the symbology isn't important to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2015 05:42:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598334#M46812</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-06-08T05:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598335#M46813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can i remove 2 unique values? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 08:36:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598335#M46813</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2015-06-15T08:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a specific unique value with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598336#M46814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;removing multiple values from lists gets tricky since the position of values in a list changes as the list gets smaller and smaller.&amp;nbsp; It is better to regenerate what you want from what you have and don't want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A small example...and one of many, many, many options is as follows.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;load, compile and run the script below&lt;/LI&gt;&lt;LI&gt;change the data and omit variables to experiment&lt;/LI&gt;&lt;LI&gt;implement on your own data and data structure&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def remove_vals(data,omit):
&amp;nbsp;&amp;nbsp;&amp;nbsp; as_set = set(data)
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_lst = [ x for x in data if x not in omit]
&amp;nbsp;&amp;nbsp;&amp;nbsp; return out_lst

if __name__=="__main__":
&amp;nbsp;&amp;nbsp;&amp;nbsp; """change below to suit"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = ["a", "d","e","b","c","a","a","a","b","a","c"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; omit = ["a","e"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; returned = remove_vals(data,omit)
&amp;nbsp;&amp;nbsp;&amp;nbsp; frmt = "\nInputs...{}\nTo remove...{}\nOutputs...{}"
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(frmt.format(data,omit,returned))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The results from the above run are as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt;
Inputs...['a', 'd', 'e', 'b', 'c', 'a', 'a', 'a', 'b', 'a', 'c']
To remove...['a', 'e']
Outputs...['d', 'b', 'c', 'b', 'c']&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now don't try to copy this code exactly on your problem...emulate and consider what you have, what you want, then go for a solution&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-remove-a-specific-unique-value-with-arcpy/m-p/598336#M46814</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T01:41:49Z</dc:date>
    </item>
  </channel>
</rss>

