KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ null first n terms for mavg

  • null first n terms for mavg

    Posted by powerpeanuts on August 10, 2022 at 12:00 am

    Hello, how can i set null for first n terms in mavg? For example,

    a: til 10

    3 mavg a gets:

    0 0.5 1 2 3…..

     

    How can I set null for the first 2 terms?

    i.e. I want to get:

    0n 0n 1 2 3…..

     

    powerpeanuts replied 9 months, 1 week ago 2 Members · 1 Reply
  • 1 Reply
  • baichen

    Member
    August 10, 2022 at 12:00 am

    To set value in a list, we can use @

    n:2
    @[3 mavg a;til n;:;0n]
    0n 0n 1 2 3 4 5 6 7 8

Log in to reply.