Had a field that had some categories that didnt make sense to be listed alphabetically so wanted to add a preceding number to the text so they would be in the order I wanted. Ran it once and it worked on all but 1 of them so I thought maybe there was an extra space so went into the field to copy and paste the value. It was the same but I copied it anyway and then when I ran it again it caused the entire column to become null. Didnt have undo on so now have to go through the entire workflow. Why did this happen so I can avoid it in the future?
def func(hab): if hab == 'Lowest': return '1. Lowest' elif hab == 'Marginal': return '2. Marginal' elif hab == 'Moderately High': return '3. Moderately High' elif hab == 'Highest': return '4. Highest'