Data cleaning: Difference between revisions

Jump to navigation Jump to search
Line 262: Line 262:
MySQL:  
MySQL:  
* find numeric values {{code | code = SELECT * FROM `my_table` WHERE `my_column` REGEXP '^[0-9]+$'}}<ref>[http://stackoverflow.com/questions/14343767/mysql-regexp-with-and-numbers-only regex - Mysql REGEXP with . and numbers only - Stack Overflow]</ref>
* find numeric values {{code | code = SELECT * FROM `my_table` WHERE `my_column` REGEXP '^[0-9]+$'}}<ref>[http://stackoverflow.com/questions/14343767/mysql-regexp-with-and-numbers-only regex - Mysql REGEXP with . and numbers only - Stack Overflow]</ref>
* find NOT numeric values {{code | code = SELECT * FROM `my_table` WHERE `my_column` NOT REGEXP '^[0-9]+$'}}
* find '''NOT''' numeric values {{code | code = SELECT * FROM `my_table` WHERE `my_column` NOT REGEXP '^[0-9]+$'}}


Excel:  
Excel:  
Line 268: Line 268:


[https://www.google.com/sheets/about/ Google Sheets]
[https://www.google.com/sheets/about/ Google Sheets]
* Using [https://support.google.com/docs/answer/3098292?hl=zh-Hant REGEXMATCH], [https://support.google.com/docs/answer/3094140?hl=zh-Hant TRIM] & [https://support.google.com/docs/answer/3093592?hl=zh-Hant CONCAT]<ref>[https://errerrors.blogspot.tw/2015/08/google.html GOOGLE 試算表: 數字轉成文字]</ref> functions: {{Kbd | key = <nowiki>=IF(REGEXMATCH(CONCAT("", TRIM(A1)), "^\d+$"), 1, "")</nowiki>}} If A1 cell is numeric will return 1, else return empty. If A1 cell contains [https://en.wikipedia.org/wiki/Scientific_notation Scientific notation] will return empty.
* Using [https://support.google.com/docs/answer/3098292?hl=zh-Hant REGEXMATCH], [https://support.google.com/docs/answer/3094140?hl=zh-Hant TRIM] & [https://support.google.com/docs/answer/3093592?hl=zh-Hant CONCAT]<ref>[https://errerrors.blogspot.tw/2015/08/google.html GOOGLE 試算表: 數字轉成文字]</ref> functions: {{code | code = <nowiki>=IF(REGEXMATCH(CONCAT("", TRIM(A1)), "^\d+$"), 1, "")</nowiki>}} If A1 cell is numeric will return 1, else return empty. If A1 cell contains [https://en.wikipedia.org/wiki/Scientific_notation Scientific notation] will return empty.
<pre>
<pre>
test data:
test data:

Navigation menu