Data cleaning: Difference between revisions

Jump to navigation Jump to search
451 bytes added ,  12 June 2015
Line 91: Line 91:


=== is null ===
=== is null ===
Finds whether a variable is NULL. [http://ideone.com/tKv2gQ online demo]
Fill 0 if the value is NA or NULL
* MySQL SQL syntax: {{kbd | key = SELECT COALESCE(column_name, 0) }} Using [http://www.w3resource.com/mysql/comparision-functions-and-operators/coalesce-function.php COALESCE() function] to replace the NULL value with 0.
* python: [http://pandas.pydata.org/pandas-docs/dev/generated/pandas.DataFrame.fillna.html pandas.DataFrame.fillna — pandas 0.16.0 documentation] "Fill NA/NaN values using the specified method"
 
Find whether a variable is NULL. [http://ideone.com/tKv2gQ online demo]
* PHP [http://tw2.php.net/is_null is_null]
* PHP [http://tw2.php.net/is_null is_null]
* Google spreadsheet / Excel:  
* Google spreadsheet / Excel:  
Line 98: Line 102:
* MySQL SQL syntax: {{kbd | key = SELECT * FROM table WHERE column IS NULL;}}<ref>[http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html MySQL :: MySQL 5.0 Reference Manual :: 3.3.4.6 Working with NULL Values]</ref>  
* MySQL SQL syntax: {{kbd | key = SELECT * FROM table WHERE column IS NULL;}}<ref>[http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html MySQL :: MySQL 5.0 Reference Manual :: 3.3.4.6 Working with NULL Values]</ref>  


Finds whether a variable is NOT NULL
Find whether a variable is NOT NULL
* MySQL SQL syntax: {{kbd | key = SELECT * FROM table WHERE column IS NOT NULL;}}
* MySQL SQL syntax: {{kbd | key = SELECT * FROM table WHERE column IS NOT NULL;}}


Navigation menu