cjm2671
cjm2671

Reputation: 19466

How do I drop rows by symbol in KDB?

I've got a table of the form:

sym date       v           ac       lR           zR          
-------------------------------------------------------------
A   1999.11.18 4.47399e+07 29.11226                          
A   1999.11.19 1.08971e+07 26.71712 -0.08585502              
A   1999.11.22 4705200     29.11226 0.08585502   1           
A   1999.11.23 4274400     26.6311  -0.08907963  -0.7267457  
A   1999.11.24 3464400     27.16703 0.01992441   0.5031717   
A   1999.11.26 1237100     27.25305 0.003161097  0.2454482   
A   1999.11.29 2914700     27.87499 0.02256457   0.4784645   
A   1999.11.30 3083000     27.91469 0.00142315   0.1285608   

I want to drop the first 60 rows of each sym.

I tried ungroup 60 _ select from table by sym but this doesn't seem right to me. What am I doing wrong?

Upvotes: 0

Views: 103

Answers (1)

terrylynch
terrylynch

Reputation: 13572

For an in-memory table you could do this:

q)t:([]sym:20?`A`B;col:til 20)
q)select from t where({x in 5_x};i)fby sym
sym col
-------
B   9
A   11
B   12
A   13
B   14
A   15
B   16
B   17
A   18
A   19

Replace "5" with however many you want to chop off

Upvotes: 2

Related Questions