It’s a bit odd to do select count col by col from t.
Is there a better way to get the aggregate count?
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0d2da; background-color: #161821; background-color: rgba(22, 24, 33, 0.95)}span.s1 {font-variant-ligatures: no-common-ligatures}q)select count,avg mcap,avg pe,avg pb,avg roe by sector from ts
sector | x mcap pe pb roe
--------------------------| --------------------------------------------
Consumer Discretionary | #: 4.001739e+10 28.84524 29.7331 24.03024
Consumer Staples | #: 6.57893e+10 23.81412 57.91088 0.02147059
Energy | #: 4.793121e+10 137.3262 2.675937 0.7021875
Financials | #: 5.384073e+10 19.67015 6.919706 10.41103
Health Care | #: 5.811604e+10 27.03917 9.436333 162.65
Industrials | #: 3.828976e+10 24.26164 9.817424 25.4391
Information Technology | #: 1.036363e+11 33.63855 11.48829 18.99714
Materials | #: 2.979766e+10 26.7072 5.1836 25.4016
Real Estate | #: 2.014384e+10 24.61939 6.209091 10.78788
Telecommunication Services| #: 1.582937e+11 12.29667 3.75 34.80667
Utilities | #: 2.321021e+10 18.28429 2.218571 2.621429
q)meta ts
c | t f a
------| -----
sym | s
pe | f
mcap | f
ps | f
pb | f
roe | f
name | s
sector| s
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0d2da; background-color: #161821; background-color: rgba(22, 24, 33, 0.95)}span.s1 {font-variant-ligatures: no-common-ligatures}q)select count each group by sector from ts
sector | x
--------------------------| -
Consumer Discretionary | 1
Consumer Staples | 1
Energy | 1
Financials | 1
Health Care | 1
Industrials | 1
Information Technology | 1
Materials | 1
Real Estate | 1
Telecommunication Services| 1
Utilities | 1
// correct
q)select numco:count sector,avg mcap,avg pe, avg pb, avg roe by sector from ts
sector | numco mcap pe pb roe
--------------------------| -----------------------------------------------
Consumer Discretionary | 84 4.001739e+10 28.84524 29.7331 24.03024
Consumer Staples | 34 6.57893e+10 23.81412 57.91088 0.02147059
Energy | 32 4.793121e+10 137.3262 2.675937 0.7021875
Financials | 68 5.384073e+10 19.67015 6.919706 10.41103
Health Care | 61 5.811604e+10 27.03917 9.436333 162.65
Industrials | 67 3.828976e+10 24.26164 9.817424 25.4391
Information Technology | 70 1.036363e+11 33.63855 11.48829 18.99714
Materials | 25 2.979766e+10 26.7072 5.1836 25.4016
Real Estate | 33 2.014384e+10 24.61939 6.209091 10.78788
Telecommunication Services| 3 1.582937e+11 12.29667 3.75 34.80667
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0d2da; background-color: #161821; background-color: rgba(22, 24, 33, 0.95)}span.s1 {font-variant-ligatures: no-common-ligatures}Utilities | 28 2.321021e+10 18.28429 2.218571 2.621429
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0d2da; background-color: #161821; background-color: rgba(22, 24, 33, 0.95)}span.s1 {font-variant-ligatures: no-common-ligatures} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d0d2da; background-color: #161821; background-color: rgba(22, 24, 33, 0.95)}span.s1 {font-variant-ligatures: no-common-ligatures}