shrug-l: Creating an If/Then Python script, ArcMap 10.7
Nathaniel Countess
nc19r at my.fsu.edu
Tue Sep 7 16:47:43 EDT 2021
Hello Scott,
While I’ll be able to take a crack at this later in the week, (I’m also brushing up on Python for similar purposes) one way to approach this would be through ArcPy’s “arcpy.da.SearchCursor” and “arcpy.da.UpdateCursor”. These classes allow Python to “look” at and modify your attribute table values, respectively, within ArcMap. Another way is through importing the table into a pandas dataframe and manipulating it from there... but ArcPy's capability to operate seamlessly w/n ArcMap is worth skipping over that learning curve.
I hope that’s a good starter for now. Will e-mail direct with a more concrete solution when time permits.
Cheers,
Nathaniel Countess
________________________________
From: SHRUG-L <shrug-l-bounces at lists.dep.state.fl.us> on behalf of Scott Crosby <scrosby at alachuacounty.us>
Sent: Tuesday, September 7, 2021 12:08:11 PM
To: SHRUG-L at lists.dep.state.fl.us <SHRUG-L at lists.dep.state.fl.us>
Subject: shrug-l: Creating an If/Then Python script, ArcMap 10.7
Hi all,
I need to create a Python script that will change the values of one field based on the values of another field. In a nutshell, I want a Field called “Fire Type” to change to a yes, no or maybe, based on the values in another field called “Name_State” where this will happen:
Name State = mesic flatwoods, or sandhill, or wet flatwoods, or pasture, or semi-improved pasture; then
Fire type = Yes
AND
Name State = (non-pyric natural community); then
Fire Type = No
AND
Name State = Basin marsh, or depression marsh, or dome swamp; then
Fire Type = Maybe
It’s been a while since I’ve dealt with Python, so any help anyone can provide would be greatly appreciated.
Thanks,
[cid:image001.png at 01D7A3E0.C6D33050]<https://urldefense.com/v3/__http://www.alachuacounty.us/Pages/AlachuaCounty.aspx__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzrRjzk3IA$>
Scott Crosby, SAF Certified Forester
Senior Environmental Specialist
Environmental Protection
408 W. University Ave Suite 106 • Gainesville • FL • 32601
352-264-6823 (office) • 352-213-0024 (mobile)
[cid:image002.png at 01D7A3E0.C6D33050]<https://urldefense.com/v3/__http://www.alachuacounty.us/Pages/AlachuaCounty.aspx__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzrRjzk3IA$> [cid:image003.png at 01D7A3E0.C6D33050] <https://urldefense.com/v3/__https://www.facebook.com/AlachuaCounty/__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzpWpdnFsQ$> [cid:image004.png at 01D7A3E0.C6D33050] <https://urldefense.com/v3/__https://twitter.com/alachuacounty__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzrqwtYZMQ$> [cid:image005.png at 01D7A3E0.C6D33050] <https://urldefense.com/v3/__https://www.instagram.com/alachuacounty/__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzqgvYqrcg$> [cid:image006.jpg at 01D7A3E0.C6D33050] <https://urldefense.com/v3/__https://www.youtube.com/user/alachuacounty__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzp3QiE36Q$> [cid:image007.png at 01D7A3E0.C6D33050] <https://urldefense.com/v3/__http://www.alachuacounty.us/depts/communications/pages/updatenewsletter.aspx__;!!Epnw_ITfSMW4!_Vj9X0JLJQ54HKJa6odQH5OnZ_VSrDFGd5XgMi1yIdXvwY47ZEicAddLpzqouyjwmw$>
PLEASE NOTE: Florida has a very broad public records law (F.S.119).
All e-mails to and from County Officials and County Staff are kept as public records. Your e-mail
communications, including your e-mail address, may be disclosed to the public and media at any time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 14043 bytes
Desc: image001.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 1595 bytes
Desc: image002.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 1737 bytes
Desc: image003.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 993 bytes
Desc: image004.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 2343 bytes
Desc: image005.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.jpg
Type: image/jpeg
Size: 958 bytes
Desc: image006.jpg
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 2189 bytes
Desc: image007.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20210907/cd6f20b9/attachment-0005.png>
More information about the SHRUG-L
mailing list