> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# aggregate_statistics_by_range

<div className="kinetica-typedoc">
  <div className="section tsd-panel tsd-member">
    <h3 className="tsd-anchor-link" id="aggregate_statistics_by_range"><span>aggregate\_statistics\_by\_range</span></h3>

    <ul className="tsd-signatures">
      <li className="">
        <div className="tsd-signature tsd-anchor-link" id="aggregate_statistics_by_range-1"><span className="tsd-kind-call-signature">aggregate\_statistics\_by\_range</span><span className="tsd-signature-symbol">(</span><br /> <span className="tsd-kind-parameter">table\_name</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">select\_expression</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span> <span className="tsd-signature-symbol">|</span> <span className="tsd-signature-type">undefined</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">column\_name</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">value\_column\_name</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">stats</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">start</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">number</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">end</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">number</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">interval</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">number</span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">options</span><span className="tsd-signature-symbol">?:</span> <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">callback</span><span className="tsd-signature-symbol">?:</span> <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a><span className="tsd-signature-symbol">,</span><br /><span className="tsd-signature-symbol">)</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/AggregateStatisticsByRangeResponse" className="tsd-signature-type tsd-kind-interface">AggregateStatisticsByRangeResponse</a><span className="tsd-signature-symbol">></span></div>

        <div className="tsd-description">
          <div className="tsd-comment tsd-typography">
            <p>Divides the given set into bins and calculates statistics of the values of a value-column in each bin. The bins are based on the values of a given binning-column. The statistics that may be requested are mean, stdv (standard deviation), variance, skew, kurtosis, sum, min, max, first, last and weighted average. In addition to the requested statistics the count of total samples in each bin is returned. This counts vector is just the histogram of the column used to divide the set members into bins. The weighted average statistic requires a weight column to be specified in weight\_column\_name. The weighted average is then defined as the sum of the products of the value column times the weight column divided by the sum of the weight column.</p>
            <p>There are two methods for binning the set members. In the first, which can be used for numeric valued binning-columns, a min, max and interval are specified. The number of bins, nbins, is the integer upper bound of (max-min)/interval. Values that fall in the range \[min+n\*interval,min+(n+1)\*interval) are placed in the nth bin where n ranges from 0..nbin-2. The final bin is \[min+(nbin-1)\*interval,max]. In the second method, bin\_values specifies a list of binning column values. Binning-columns whose value matches the nth member of the bin\_values list are placed in the nth bin. When a list is provided, the binning-column must be of type string or int.</p>
            <p>NOTE: The Kinetica instance being accessed must be running a CUDA (GPU-based) build to service this request.</p>
          </div>

          <div className="tsd-parameters">
            <h4 className="tsd-parameters-title">Parameters</h4>

            <ul className="tsd-parameter-list">
              <li>
                <span><span className="tsd-kind-parameter">table\_name</span>: <span className="tsd-signature-type">string</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Name of the table on which the ranged-statistics operation will be performed, in \[schema\_name.]table\_name format, using standard name resolution rules.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">select\_expression</span>: <span className="tsd-signature-type">string</span> <span className="tsd-signature-symbol">|</span> <span className="tsd-signature-type">undefined</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>For a non-empty expression statistics are calculated for those records for which the expression is true.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">column\_name</span>: <span className="tsd-signature-type">string</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Name of the binning-column used to divide the set samples into bins.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">value\_column\_name</span>: <span className="tsd-signature-type">string</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Name of the value-column for which statistics are to be computed.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">stats</span>: <span className="tsd-signature-type">string</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>A string of comma separated list of the statistics to calculate, e.g. 'sum,mean'. Available statistics: mean, stdv (standard deviation), variance, skew, kurtosis, sum.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">start</span>: <span className="tsd-signature-type">number</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>The lower bound of the binning-column.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">end</span>: <span className="tsd-signature-type">number</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>The upper bound of the binning-column.</p>
                </div>
              </li>

              <li>
                <span><span className="tsd-kind-parameter">interval</span>: <span className="tsd-signature-type">number</span></span>

                <div className="tsd-comment tsd-typography">
                  <p>The interval of a bin. Set members fall into bin i if the binning-column falls in the range \[start+interval<span className="em">i, start+interval</span>(i+1)).</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">options</span>: <span className="tsd-signature-type">Record</span><span className="tsd-signature-symbol">\<</span><span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">,</span> <span className="tsd-signature-type">string</span><span className="tsd-signature-symbol">></span></span>

                <div className="tsd-comment tsd-typography">
                  <p>Optional parameters.</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">callback</span>: <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a></span>

                <div className="tsd-comment tsd-typography">
                  <p>Optional callback function</p>
                </div>
              </li>
            </ul>
          </div>

          <h4 className="tsd-returns-title">Returns <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/AggregateStatisticsByRangeResponse" className="tsd-signature-type tsd-kind-interface">AggregateStatisticsByRangeResponse</a><span className="tsd-signature-symbol">></span></h4>
          <p>Promise\<Types.AggregateStatisticsByRangeResponse> - Promise resolving to the response</p>

          <div className="aside tsd-sources">
            <ul>
              <li>Defined in <a href="https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L3515">src/GPUdb.ts:3515</a></li>
            </ul>
          </div>
        </div>
      </li>
    </ul>
  </div>

  <div className="section tsd-panel tsd-member">
    <h3 className="tsd-anchor-link" id="aggregate_statistics_by_range_request"><span>aggregate\_statistics\_by\_range\_request</span></h3>

    <ul className="tsd-signatures">
      <li className="">
        <div className="tsd-signature tsd-anchor-link" id="aggregate_statistics_by_range_request-1"><span className="tsd-kind-call-signature">aggregate\_statistics\_by\_range\_request</span><span className="tsd-signature-symbol">(</span><br /> <span className="tsd-kind-parameter">request</span><span className="tsd-signature-symbol">:</span> <a href="/content/api/javascript/interfaces/AggregateStatisticsByRangeRequest" className="tsd-signature-type tsd-kind-interface">AggregateStatisticsByRangeRequest</a><span className="tsd-signature-symbol">,</span><br /> <span className="tsd-kind-parameter">callback</span><span className="tsd-signature-symbol">?:</span> <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a><span className="tsd-signature-symbol">,</span><br /><span className="tsd-signature-symbol">)</span><span className="tsd-signature-symbol">:</span> <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/AggregateStatisticsByRangeResponse" className="tsd-signature-type tsd-kind-interface">AggregateStatisticsByRangeResponse</a><span className="tsd-signature-symbol">></span></div>

        <div className="tsd-description">
          <div className="tsd-comment tsd-typography">
            <p>Divides the given set into bins and calculates statistics of the values of a value-column in each bin. The bins are based on the values of a given binning-column. The statistics that may be requested are mean, stdv (standard deviation), variance, skew, kurtosis, sum, min, max, first, last and weighted average. In addition to the requested statistics the count of total samples in each bin is returned. This counts vector is just the histogram of the column used to divide the set members into bins. The weighted average statistic requires a weight column to be specified in weight\_column\_name. The weighted average is then defined as the sum of the products of the value column times the weight column divided by the sum of the weight column.</p>
            <p>There are two methods for binning the set members. In the first, which can be used for numeric valued binning-columns, a min, max and interval are specified. The number of bins, nbins, is the integer upper bound of (max-min)/interval. Values that fall in the range \[min+n\*interval,min+(n+1)\*interval) are placed in the nth bin where n ranges from 0..nbin-2. The final bin is \[min+(nbin-1)\*interval,max]. In the second method, bin\_values specifies a list of binning column values. Binning-columns whose value matches the nth member of the bin\_values list are placed in the nth bin. When a list is provided, the binning-column must be of type string or int.</p>
            <p>NOTE: The Kinetica instance being accessed must be running a CUDA (GPU-based) build to service this request.</p>
          </div>

          <div className="tsd-parameters">
            <h4 className="tsd-parameters-title">Parameters</h4>

            <ul className="tsd-parameter-list">
              <li>
                <span><span className="tsd-kind-parameter">request</span>: <a href="/content/api/javascript/interfaces/AggregateStatisticsByRangeRequest" className="tsd-signature-type tsd-kind-interface">AggregateStatisticsByRangeRequest</a></span>

                <div className="tsd-comment tsd-typography">
                  <p>Request object containing the parameters for the operation</p>
                </div>
              </li>

              <li>
                <span><code className="tsd-tag">Optional</code><span className="tsd-kind-parameter">callback</span>: <a href="/content/api/javascript/types/GPUdbCallback" className="tsd-signature-type tsd-kind-type-alias">GPUdbCallback</a></span>

                <div className="tsd-comment tsd-typography">
                  <p>Optional callback function</p>
                </div>
              </li>
            </ul>
          </div>

          <h4 className="tsd-returns-title">Returns <span className="tsd-signature-type">Promise</span><span className="tsd-signature-symbol">\<</span><a href="/content/api/javascript/interfaces/AggregateStatisticsByRangeResponse" className="tsd-signature-type tsd-kind-interface">AggregateStatisticsByRangeResponse</a><span className="tsd-signature-symbol">></span></h4>
          <p>Promise\<Types.AggregateStatisticsByRangeResponse> - Promise resolving to the response</p>

          <div className="aside tsd-sources">
            <ul>
              <li>Defined in <a href="https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L3454">src/GPUdb.ts:3454</a></li>
            </ul>
          </div>
        </div>
      </li>
    </ul>
  </div>
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.