I am trying to calculate my End_Streets field within two joined tables. I want to remove the redundant SECONDARYN value from the STREETS field.

" & ".join(!IntersectAndEnds2.Streets!.split(" & ").remove(!StreetSplit2.SECONDARYN!))

Here is a portion of my table:

Joined Table

Here is the error I am receiving when I run the expression in the field calculator.

enter image description here

Error typed out:

ERROR 000539: Error running expression: " & ".join(u"ACORN CT & LARAN RD".split(" & ").remove(u"ACORN CT"))
Traceback (most recent call last):
File "", line1, in TypeError Failed to execute (CalculateField)

  • To confirm, you're wanting to remove the value in SECONDARYN from STREETS? So ACORN CT & LARAN RD becomes LARAN RD?
    – Midavalo
    May 12, 2016 at 19:31
  • Are you trying to modify field in a joined table?
    – Midavalo
    May 12, 2016 at 19:50

2 Answers 2


You are trying to join a List.remove (returned from .split()), but a List.remove doesn't return anything, so you'd have to remove the item from the list and then join, or if you want to do it inline, I think this would work to exclude what you don't want:

" & ".join(i for i in !IntersectAndEnds2.Streets!.split(" & ") if i <> !StreetSplit2.SECONDARYN!)
  • And actually my answer doesn't quite work because arcmap thinks the != is a field rather than "not equal". May 12, 2016 at 20:02
  • 2
    change it to <>
    – Midavalo
    May 12, 2016 at 20:03
  • Thanks. I actually didn't know that Python accepted that. May 12, 2016 at 20:08
  • See docs.python.org/release/2.5.2/lib/comparisons.html - <> is obsolescent however in this case it works as the ! is signifying something else to arcgis
    – Midavalo
    May 12, 2016 at 20:13
  • I have been struggling with this for two days because I'm not a python person. This worked flawlessly. Thank you so much!
    – hherrmann
    May 12, 2016 at 20:41

If I understand what you're asking, you want to remove the "ACORN CT & " from "ACORN CT & LARAN RD", leaving just "LARAN RD".

Try this expression

!STREETS!.replace("{} & ".format( !SECONDARYN! ), '').replace(" & {}".format( !SECONDARYN! ), '')

which will leave just "LARAN RD".

I am concerned that you are trying to update a joined table. Your table in the screenshot is called StreetSplit2 but in your expression it looks like the Streets field is in another table called IntersectAndEnds2. You can't update a joined table using the field calculator, you'd need to calculate that field in the actual table (and if necessary perform the join in the other direction).

  • 1
    I don't think this would not for the case where the SECONDARYN field value is the last road in the list. May 12, 2016 at 21:59
  • @RichardFairhurst nice spot, have updated around that.
    – Midavalo
    May 12, 2016 at 23:31
  • It also would not work for the case where there is no cross street and only the road itself is listed, which can occur for her data since it includes cul-de-sac, stub and dead end points. May 13, 2016 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.