For example, in SQL, to select a series of rows from a table where an attribute is NULL is performed using the command:
SELECT * FROM [TABLE_NAME] WHERE [FIELD] IS NULL
This query will return any row in which FIELD is empty, regardless of why it is empty.
In python things are a bit more complex, there are three possible types of null which python can deal with and knowing which null type you are using is important in avoiding seemingly inexplicable errors from cropping up.
The three types are:
- None - the python equivalent of SQL's NULL
- "" - an empty string
- An unassigned variable
These three types can be demonstrated at the python shell:
>>> x == y False >>>
They may conceptually be the same thing, but the interpreter considers them to be distinct, which can present problems when trying to set loop conditions, or run models until a null value is filled or encountered. The key is to be clear at the outset which kind of null values you will be encountering.
No comments:
Post a Comment