Attribute analysis and statistics
Understanding attribute fields and finding unique values
Learn the field types Orbis uses, see the distinct values of a field with their counts, and read quick statistics of a numeric field.
You will learn
- Recognise text, integer, real, boolean and date fields.
- List the distinct values of a field and how often they occur.
- Read count, NULL, minimum, maximum, mean and median of a field.
Prerequisites
Data for this tutorial
Sample villages (synthetic) Download villages.zip
- Format
- ESRI Shapefile (ZIP: .shp, .shx, .dbf, .prj, .cpg)
- Geometry
- Point
- CRS
- EPSG:4326 (WGS 84 longitude, latitude)
- Content
- 25 villages in 5 districts of 2 states
Fields used in the tutorials
| Field | Type | Description |
|---|---|---|
village_id | text | Identifier V001 to V025. |
village | text | Village name. Common names repeat (Rampur, Shivpur, Madhopur), as they do in real gazetteers. |
district | text | District: Rampur, Varanasi, Jaunpur, Patna or Gaya. |
state | text | State: Uttar Pradesh or Bihar. |
population | integer | Residents. One village (Amarpur) has no recorded population (NULL). |
households | integer | Households. |
has_school | text | yes or no. |
Licence: CC0 1.0. All tutorial data is synthetic and generated by Orbis. About the datasets
The task
Before you count or summarise, you need to know your fields: their types and the values they contain. A district field with "Jaunpur" and "Jaunpur " (trailing space) would give you two districts; a population field stored as text cannot be summed.
Steps
- Load
villages.zipand open its attribute table (F6).
Hover over the column headers. The tooltip names the field and its type:
Type Holds Example in villages string text village,district,state,has_schoolinteger whole numbers population,householdsreal decimal numbers (none) boolean true or false (none) date dates (ISO text such as 2024-03-01) (none)
Right-click the
districtheader and choose Field statistics & unique values. A panel opens beside the table with the number of values, the number of NULL (empty) values, the number of distinct values (here 5) and the list of values with how often each occurs. Click a value to select the villages that have it.
Field statistics & unique values for the district field.
- Do the same for
population. For numbers the panel also gives the minimum, maximum, sum, mean, median, standard deviation and quartiles. The NULL count is 1: Amarpur has no recorded population.
- For a report you can keep, run Basic statistics for field from the Toolbox. Its results appear in the Processing log.
Expected result
You know that district has 5 distinct values and that population is an integer field with one NULL value. The values list of district already shows the number of villages per district; the next tutorial turns such counts into a table you can export.
Common mistakes
- Treating NULL as zero. An empty value is unknown, not 0. Statistics skip NULL values, so the mean of
populationis the mean of 24 villages. - Numbers stored as text. If a numeric column was read as text (for example because one cell holds "n/a"), it shows type string and cannot be summed. Load the file again with type detection, or convert it with the Field calculator (
to_real("field")).
Troubleshooting
- The statistics panel does not open. Right-click exactly on the column header, not on a cell.
- Values look identical but count separately. They differ in case or spaces. Compare them with the Expression console, for example
length("district").