Delete all columns that have zeros in all rawsWell, that is what I need to do.
I tried to look for similar scripts but I have not found the solution.
Thanks in advance.
Manel
Re: Delete all columns that have zeros in all rawsYou could do something like:
If(
N Rows( dt << get rows where( Column( dt, numericColNames[i] ) == 0 ) ) >
N Rows( dt ) / 2,
Insert Into( allZerosList, numericColNames[i] )
);
Re: Delete all columns that have zeros in all rawsCan this be tweaked such that I can remove columns that have mostly zeros (eg. 50% of more of the rows)?
Thanks.Re: Delete all columns that have zeros in all rawsThanks, Sir.Re: Delete all columns that have zeros in all rawsHere is a simple script that will delete all columns that are all zeros
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 )
); Re: Delete all columns that have zeros in all rawsHi @gallardet
for starters try this:
https://community.jmp.com/t5/Discussions/Select-and-Delete-a-Column-Where-All-Rows-Have-The-Same-Value/m-p/62142/highlight/true#M33477
ron