你可以這樣做:
If(
N Rows( dt << get rows where( Column( dt, numericColNames[i] ) == 0 ) ) >
N Rows( dt ) / 2,
Insert Into( allZerosList, numericColNames[i] )
);
這是一個簡單的腳本,它將刪除所有全零的列
Names Default To Here( 1 );
dt = Current Data Table();
numericColNames = dt << get column names( string, numeric );
allZerosList = {};
For( i = 1, i <= N Items( numericColNames ), i++,
If( Col Sum( Column( dt, numericColNames[i] ) ) == 0
& Col Std Dev( Column( dt, numericColNames[i] ) ) == 0,
Insert Into( allZerosList, numericColNames[i] )
)
);
If( N Items( allZerosList ) > 0,
dt << delete columns( allZerosList )
);