I keep getting errors that it does not append when trying to do this.
Yes. If it can't convert the string into a number, the conversion will fail. You need to strip out the character:
# NewField = convert(!OldField!) # Code Block def convert(x): try: x = x.replace('"', '') return float(x) except: return None
You can't update the field type if there is data in the field.
Perhaps you can elaborate on what you are trying to do for alternate suggestions
i know that. the only work around was to create another field with the desired data type and fill it, however that is not working
Create a new Double field, then run Calculate Field with this Python expression (note the exclamation marks in line 2):
# NewField = convert(!OldField!) # Code Block def convert(x): try: return float(x) except: return None
Or if you don't want to use a code block... (substitute !junk! for your field name of course)
float(!junk!) if !junk!.isnumeric() else None
These sound great. My specific issue is related to pipe diameter. So they have the " inch sign attached to the numbers, and that may be why it is not going into the double field?
Awesome, that seemed to do the trick, thanks!
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.