Skip to content

Commit

Permalink
Kurt function iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Gómez committed Jan 12, 2024
1 parent 74cb599 commit 77e8617
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pykx/pandas_api/pandas_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ def kurt(self, axis: int = 0, numeric_only: bool = False):
val_str = '' if axis == 0 else '"f"$value '
query_str = 'cols tab' if axis == 0 else 'til count tab'
where_str = ' where not (::)~/:r[;1]'
kurt_str = ('{adjusted: x - avg x;'
kurt_str = ('{res: x - avg x;'
'n: count x;'
'm2: sum adjusted_sq: adjusted xexp 2;'
'm4: sum adjusted_sq xexp 2;'
'adj: 3 * xexp[n-1; 2] % (n - 2) * (n - 3);'
'numerator: n * (n + 1) * (n - 1) * m4;'
'denominator: (n - 2) * (n - 3) * m2 xexp 2;'
'(numerator % denominator) - adj}')
'm2: sum res_sq: res xexp 2;'
'm4: sum res_sq xexp 2;'
'adj: 3 * xexp[n - 1;2] % (n - 2) * (n - 3);'
'num: n * (n + 1) * (n - 1) * m4;'
'den: (n - 2) * (n - 3) * m2 xexp 2;'
'(num % den) - adj}')
return q(
'{[tab]'
f'r:{{[tab; x] ({key_str}x; {kurt_str} {val_str}tab[x])}}[tab;] each {query_str};'
Expand Down

0 comments on commit 77e8617

Please sign in to comment.