How do I convert a field value to NULL?

27772
18
Jump to solution
02-12-2018 12:28 PM
StewartGalloway
New Contributor III

How do I convert a field value to NULL?  I tried Calculate. Not sure how to use Python = "none" but I could not get it to work.

Thanks.

Stew

18 Replies
TedKowal
Occasional Contributor III

That looked interesting.... I did like Fortran

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

maybe something like this.

In above example, the value of 0 is replaced by <Null>



Think Location
StewartGalloway
New Contributor III

Reply to all,

Thanks very much for the help!  There were two parts to the solution using the Field Calculator to enter "None".

1) case-sensitive
2) use the python parser

Stew

0 Kudos
DanPatterson_Retired
MVP Emeritus

Stewart... also remember in Python and for fields that are 'nullable'

there is only one  .... None .... 

you use it for all field types... text, numbers etc

https://community.esri.com/blogs/dan_patterson/2015/04/17/none-isntnor-is-0-or-1-more-explorations-i...

https://community.esri.com/blogs/dan_patterson/2016/11/03/before-i-forget-18-those-pesky-null-things

https://community.esri.com/blogs/tilting/2015/05/29/whats-in-your-feature-class-nothing-null-or-empt...

and who said there is nothing more to learn about nothing

FranciscoCosta1
Occasional Contributor

If you are trying to handle missing data usually Data Scientists like me advise to use np.nan because of this:

python - What is the difference between NaN and None? - Stack Overflow 

for consistency i would recommend this:

myfieldvalue=np.nan otherwise you can do else.

0 Kudos
DanPatterson_Retired
MVP Emeritus

This has also been brought up before in the context of geometry definitions, but probably too late to implement any changes

https://community.esri.com/blogs/dan_patterson/2018/01/12/point-of-view-on-points

0 Kudos
FranciscoCosta1
Occasional Contributor

Ok, really wasn't considering the point(geometry) fields. So while for non point(geometry) fields perhaps is a good idea to consider np.nan, for point(geometry) fields go with math.nan accordingly.

0 Kudos
DanPatterson_Retired
MVP Emeritus

for vector geometry, I simply use numpy arrays with np.nan and I can convert back and forth between arc* geometry using a variety of means.

But I suspect this should be a separate thread

0 Kudos
FranciscoCosta1
Occasional Contributor

hence what i originally posted accordingly

0 Kudos