I'm comparing two versions of a feature class one of which has <Null> spelled out in blank fields and the other just has blanks. Because of this difference, when I run the Detect Feature Changes tool, every feature shows up as having (at minimum) an attribute change. I want to want to run some python code to change either all <Null> to (blank) or vice versa so I can tell which features have been significantly changed. Is there an advantage to one or the other?
Thanks,
Matt
Solved! Go to Solution.
A "blank" cell could be truly an empty string, or it could contain one space or more than one space or any of the non-printable utf characters. looking at the field wouldn't reveal what is what.
Also, numeric can't be represented by any nodata value, except for floats/decimal where there is NaN (not a number, but sadly, there isn't one for integers.
Spreadsheets have brought this empty cell evil to the world of GIS <NULL> is a good clue that the cell is not occupied.
A "blank" cell could be truly an empty string, or it could contain one space or more than one space or any of the non-printable utf characters. looking at the field wouldn't reveal what is what.
Also, numeric can't be represented by any nodata value, except for floats/decimal where there is NaN (not a number, but sadly, there isn't one for integers.
Spreadsheets have brought this empty cell evil to the world of GIS <NULL> is a good clue that the cell is not occupied.
Thanks, Dan!
It sounds like I should replace blank cells with <Null>. I noticed when I typed in <Null> in the title of this post, it would not show up until I changed the text to "Null". If I use the code below, will I run into problems because of the <> symbols?
'<Null>' if !field! is None else !field!
No, that wouldn't be wise, and it might not work -- What if the string field has a width of 5 or less?
You'd be better off reviewing the non-NULL empty fields for why they have corrupt values, rather than corrupting the valid NULLs.
- V
Don't do what you are planning on doing!
If you want the field to be NULL for records, then use Python None which is the Python mapping to SQL NULL. Writing out a text field with the same character representation that ArcGIS shows for SQL NULL will create massive confusion.
Should I instead clear the <Null> values in the other feature class using your code?:
'' if !field! is None else !field!
Why do you want to store empty strings instead of NULL? If there is no data present for a given field and row, NULL is the common marker. I say marker instead of value because NULL indicates a value is unknown and is not a value in and of itself (this is also why checks for NULL use IS instead of equals).
I think the better approach would be converting fields with either an empty string or only whitespace characters to NULL:
None if !field!.strip() == '' else !field!
I have an original dataset and a copy of the same. In the copy, all the <Null> values became blank, Maybe when it was copied? People have been making edits to both the copy and to the original and I'm trying to reconcile the two. When I run the Detect Feature Changes tool, every feature shows as having an attribute changed and I think that's because of the missing <Null>s. I want all the <Null>s/blanks to look the same so that when I run the tool, only the changes people actually made are detected
And in my previous incarnation... there is this missive
The solution to <null> in tables - Esri Community