8.41. isnull NULL値判定¶
書式1: isnull,isnull,isnull,isnull,isnull(bool)
\(num\) (他のデータ型も同様)で与えられた値がNULL値であるかどうかを判定する。
NULL値であれば 0b1
(真)を、そうでなければ 0b0
(偽)を返す。
利用例¶
importと入力データ(CSV)の準備
1import nysol.mcmd as nm 2 3with open('dat1.csv','w') as f: 4 f.write( 5'''id,val 61,a 72, 83,b 9''')
基本例
1nm.mcal(c='isnull(${val})', a='rsl', i="dat1.csv", o="rsl1.csv").run() 2### rsl1.csv の内容 3# id,val,rsl 4# 1,a,0 5# 2,,1 6# 3,b,0
他の項目型も指定可能
1nm.mcal(c='isnull($s{val})', a='rsl', i="dat1.csv", o="rsl2.csv").run() 2### rsl2.csv の内容 3# id,val,rsl 4# 1,a,0 5# 2,,1 6# 3,b,0
空文字を定数で与えた場合
1nm.mcal(c='isnull("")', a='rsl', i="dat1.csv", o="rsl3.csv").run() 2### rsl3.csv の内容 3# id,val,rsl 4# 1,a,1 5# 2,,1 6# 3,b,1