Hi,
I am having a massive problem with running this script in ArcGIS 10.3 Field Calculator Python
def Reclass(CLASS): if CLASS=="2": return "2a" elif CLASS=="3" return "3a" else: return (CLASS)
Any help much appreciated.
Thank you,
Marta
Try this:
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">Reclass</SPAN><SPAN class="punctuation token">(</SPAN>CLASS<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> CLASS<SPAN class="operator token">==</SPAN><SPAN class="string token">"2"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="string token">"2a"</SPAN> <SPAN class="keyword token">elif</SPAN> CLASS<SPAN class="operator token">==</SPAN><SPAN class="string token">"3"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="string token">"3a"</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> CLASS<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
You are welcome, glad it works
Hi Xander,
It is working now. I have not realised that the spacing is so important. Thank you
If Xander's suggestion doesn't work, it would be helpful if you explain what exactly isn't working, including posting the error message(s).
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.