# VariableStatistics

## Get definition

```javascript
{
	"kind": "variableStatistics",
	"uri": string,
	"url": string,
	"variable": {
	  "kind": variable,
	  "name": str,
	  "type": str (enum variable_type)
	},
	"status": string("queued","running","completed","failed"),
	"count": integer,
	"numDistinct": integer,
	"min": number,
	"max": number,
	"mean": number,
	"approxMedian": number,
	"frequencyDistribution": null | [
	  { 
	    value: number | string | boolean, 
	    count: number,
	    label: string | null
	  }
	],
	"geoCentroid": {
	  "longitude": number,
	  "latitude" number
	},
	"geoBBox": {
	  "westLongitude": number,
	  "eastLongitude": number,
	  "northLatitude": number,
	  "southLatitude": number
	}
}
```

## Documentation

| Fields                                                                                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |        |                                                                                        |
| ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------- |
| **Get**                                                                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |        |                                                                                        |
| kind                                                                                           | <p><strong>string</strong></p><p>The resource type. Will always be "variable".</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |        |                                                                                        |
| uri                                                                                            | <p>The fully qualified reference to these statistics, for use in generating calls to this API. </p><p>For example, <code>/tables/demo.example:123.test:456/variables/var1/statistics</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                     |        |                                                                                        |
| url                                                                                            | <p><strong>string</strong><br>The variable's discoverable url through a web browser interface, which also displays the variable's statistics.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |        |                                                                                        |
| variable                                                                                       | <p><strong>object</strong><br>The corresponding variable for the statistics, with properties corresponding to the <a href="../variable#base-definition">variable.base</a> definition.<br><br>Useful for accessing the variable type when parsing statistic values.</p>                                                                                                                                                                                                                                                                                                                                                                              |        |                                                                                        |
| status                                                                                         | <p><strong>string</strong></p><p>The current status of the statistic's computation. Will be one of completed, running, queued, or failed. If the statistic is failed, it can only be recomputed in the UI.<br><br>Other statistic fields will only be populated once <code>status == "completed"</code></p>                                                                                                                                                                                                                                                                                                                                         |        |                                                                                        |
| count                                                                                          | <p><strong>integer</strong></p><p>The number of non-null values for this variable. </p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |        |                                                                                        |
| numDistinct                                                                                    | <p><strong>integer</strong></p><p>The number of distinct values for this variable.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |        |                                                                                        |
| min                                                                                            | <p><strong>number</strong></p><p>The minimum value of this variable. <br><br>Will be null for variables of boolean type. </p><p></p><p>If the variable is of type <code>date</code> or <code>dateTime</code>, this number represents the number of milliseconds since the epoch (<code>1970-01-01</code>). If the variable is of type <code>time</code>, this number represents the number of milliseconds since <code>00:00:00</code>.<br><br>If the variable is of type <code>string</code>, will be the minimum string length.<br><br>If the variable is of type <code>geography</code>, will be the minimum number of vertices encountered.</p> |        |                                                                                        |
| max                                                                                            | <p><strong>number</strong></p><p>The maximum value of this variable. <br><br>See statistic.min for information about different variable types.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |        |                                                                                        |
| mean                                                                                           | <p><strong>number</strong></p><p>The average value of this variable. <br><br>See statistic.min for information about different variable types.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |        |                                                                                        |
| approxMedian                                                                                   | <p><strong>number</strong></p><p>The approximate median of this variable. Uses the <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/approximate_aggregate_functions#approx_quantiles">BigQuery APPROX\_QUANTILES function.</a></p><p></p><p>See statistic.min for information about different variable types.</p>                                                                                                                                                                                                                                                                                                             |        |                                                                                        |
| stdDev                                                                                         | <p><strong>number</strong></p><p>The sample (unbiased) standard deviation of this variable.<br><br>Will be null for variables of <code>string</code> and <code>boolean</code> type. For all other variable types this will be a number.</p><p></p><p>If the variable is of type <code>date</code> , <code>time</code>, or <code>dateTime</code>, this number measures the standard deviation in milliseconds.</p>                                                                                                                                                                                                                                   |        |                                                                                        |
| frequencyDistribution\[]                                                                       | <p><strong>object</strong><br>The frequencyDistribution, if present, is an array of values observed and their respective counts.<br><br>Note that frequency distribution may not always be present (e.g., for variables with high heterogeneity of values), and is limited to the 10,000 most common values – meaning that it may only represent a subset of values on the variable.</p>                                                                                                                                                                                                                                                            |        |                                                                                        |
| frequencyDistribution.value                                                                    | <p><strong>number                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | string | boolean</strong><br>The observed value. Type will correspond to the variable type.</p> |
| frequencyDistribution.count                                                                    | <p><strong>number</strong><br>The count of observations that match this value</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |        |                                                                                        |
| frequencyDistribution.label                                                                    | <p><strong>string</strong><br>Included if the variable has specified valueLabels in its metadata, and there is a corresponding label for this value.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |        |                                                                                        |
| geoCentroid                                                                                    | <p><strong>object</strong><br>An object containing <code>longitude</code> and <code>latitude</code> properties, representing the weighted centroid of all geometries.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |        |                                                                                        |
| geoBBox                                                                                        | <p><strong>object</strong><br>An object describing the geographic bounding box of the variable. Will only be present for variables of "geography" type.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |        |                                                                                        |
| <p>geoBBox<br>  .westLongitude<br>  .eastLongitude<br>  .northLatitude<br>  .southLatitude</p> | <p><strong>number</strong><br>Each property represents one side of the bounding box, expressed in numeric degrees.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |        |                                                                                        |
