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.

Beginner2 min read

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
FieldTypeDescription
village_idtextIdentifier V001 to V025.
villagetextVillage name. Common names repeat (Rampur, Shivpur, Madhopur), as they do in real gazetteers.
districttextDistrict: Rampur, Varanasi, Jaunpur, Patna or Gaya.
statetextState: Uttar Pradesh or Bihar.
populationintegerResidents. One village (Amarpur) has no recorded population (NULL).
householdsintegerHouseholds.
has_schooltextyes 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

  1. Load villages.zip and open its attribute table (F6).
  1. Hover over the column headers. The tooltip names the field and its type:

    TypeHoldsExample in villages
    stringtextvillage, district, state, has_school
    integerwhole numberspopulation, households
    realdecimal numbers(none)
    booleantrue or false(none)
    datedates (ISO text such as 2024-03-01)(none)
  1. Right-click the district header 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 of the district field: 25 values, 5 distinct, and the list of districts with their counts
    Field statistics & unique values for the district field.
  1. 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.
  1. 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 population is 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").