Timeseries/table - Apply filter on columns

Dear Scilab community,

I’ve been using Scilab for several years, but now, I’m learning how to use the new timeseries / table functions to handle big amount of data.
I’m wondering how to get a new matrix or table from a previous table but with filtered “lines”.

An example would be clearer :slight_smile:

str=["a";"b";"c";"d"]
data=[2 3; 6 6;5 4; 1 2]
t1=table(str,data,"VariableNames",["name" "var1" "var2"])

t2=t1("name")(t1("var1")>2)
t3=t1("var1")(t1("var1")>2 & t1("var2")<5)
 t1  = 

4x3 table
   name   var1   var2
   ____   ____   ____
                     
   a      2      3   
   b      6      6   
   c      5      4   
   d      1      2  

t2 : Filter on “var1” Works fine to get the name column with filtered lines in a new vector

t2  = 

  "b"
  "c"

t3 : Filter on “var1” and “var2” Works fine to get the var1 column with filtered lines in a new vector

 t3  = 

   5.

My problem :

t4=t1(#all_table#)(t1("var1")>=2)

Result expected :

t4=

4x3 table
   name   var1   var2
   ____   ____   ____
                     
   a      2      3   
   b      6      6   
   c      5      4   

How to get all columns of t1 with filtered lines ? in a matrix, string matrix or better, a new table ?

I’ve tryied t1( : ) t1( : , : ) but I probably misunderstand the table objects.

Thanks a lot for your help.

Best regards,
Laurent

Hello Laurent,

First, welcome on Scilab’s Discourse forum !

In order to make your post more readable and also “copy/pasteable”, can you use code blocks markers for inline and displayed code (see Welcome to the Scilab discourse forum!).

S.

1 Like

Hello Mottelet,
Thank you for the tutorial.
Hope it is more readable now.

Laurent

1 Like

Hello Laurent,
I just read your post a while after last visit, you may have found the syntax in the meantime:
t4=t1(t1("var1")>=2,:) //or t4=t1(t1.var1 >=2,:)

David

1 Like

Hi David,
No, I didn’t find a simple solution in the meantime, yours works perfectly and is what I expected. Thanks a lot for your help.

Laurent

What about skewness and kurtosis in the stats to complet a little bit this toolbox?

Hello,

You are likely out of topic there, timeseries are a built-in feature of Scilab.

S.

Sorry! :slight_smile:

But i thought about group summary methods. With kurtosis and excess the normal distribution would be fully specified for statistik.

M.f.g. Pascal