liveBook · Manning

Natural number

As explained in Grokking Statistics

A whole number is a nonnegative integer, including zero and excluding negative values and fractional values.

A natural number is a whole number used for counting: 0, 1, 2, 3, and so on. It excludes negative and fractional values. Some conventions reserve “natural number” for positive values and call the version including 0 “whole numbers,” so check which convention is being used. section 2.9

Natural numbers appear whenever data records counts, such as concert attendance, children in a family, or customer complaints. They can also serve as identifiers or encode categories—for example, 0 for CAT, 1 for DOG, and 2 for BIRD—but those codes do not make the categories numerical quantities. section 2.8 section 2.9

Listing natural numbers in Python

naturals = [i for i in range(0, 15)] print(naturals) This produces the whole numbers from 0 through 14. Python’s decimal notation uses the digits 0 through 9 and combines them by place value to represent larger numbers. section 2.9

A recorded value can look like a natural number without representing a discrete quantity. Baristas may report coffee measurements as whole grams because kitchen scales and working habits limit precision, while the ideal amount could theoretically lie between grams. Treating every whole-number measurement as a count can therefore misclassify the variable. section 4.3

naturals = [i for i in range(0,15)]  #1
print(naturals)  #2

Run the short Python listing to see a sequence of natural numbers generated with range(). section 2.9

How Grokking Statistics covers it

How deep it goes
Defines whole-number membership, demonstrates Python iteration, and stops short of a full survey of number theory.
Examples
Uses blocks, stuffed animals, toy cars, apples, attendance, family size, complaints, category codes, and coffee measurements.
What it assumes
Assumes basic counting and introduces numeric data types, decimal notation, place value, and Python iteration.
What you can do after
Evaluate whether a data value represents a count, a code, or a continuous measurement recorded at whole-number precision.
How it connects
Connects natural numbers to integers, Boolean values, floating-point values, categorical encoding, counts, and continuous measurements.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Statistics. The section links point to the parts of the book it draws on.