I'm working in ArcGIS Pro 3.1 using Field Calculator. I have a table where I want to transfer specific values of one column into another. Column B is a list of full, tidy names of parks. Column A is a similar, less-tidy list, but it does note some locations where the data collector specifically wrote that they were not in a protected area (rather than the protected area being missing and something to follow up on). Thus, I want to be able to fill column B with column A's value only if column A= "Not in protected area" and column B is empty, like in row 4 of the below table.
| Column A | Column B |
| A | Park A |
| Null | Park B |
| Not in protected area | Park C |
| Not in protected area | Null |
Here is the code I have so far in Calculate Field for Column B.
(in expression line) COLUMN_B = reclass(!COLUMN_B!)
(in code block)
def reclass(COLUMN_B):
if (COLUMN_B == None) and (COLUMN_A == "Not in Protected Area"):
return "Not in Protected Area"
else:
return COLUMN_BStrangely, this code makes column A entirely equal to column B rather than calculating column B. Why is this code editing column A? How do I make it only bring my desired values of column A into column B? Any advice would be greatly appreciated.