Data Types: The Building Blocks of Every Dataset
Every piece of information a computer handles has to be sorted into a category before it can be used. A data type is that category: it tells a system what kind of value something is — a whole number, a piece of text, a date, a true-or-false flag — and therefore what can sensibly be done with it. Choosing types well is one of the quiet decisions that shapes everything downstream, from whether a calculation is correct to whether a file loads at all.
The basic families
Most programming languages share a common core. Integers hold whole numbers, positive or negative, with no fractional part. Floating-point numbers (often called floats or doubles) represent values with decimals, but they store approximations rather than exact fractions, which is why money is usually handled with dedicated decimal types instead. Strings hold text of any length, including characters that are not letters. Booleans hold only true or false. Dates and times are their own category, and treating them as plain text is a frequent source of confusion.
Around these sit composite types: arrays or lists that hold many values in order, records or objects that group named fields together, and dictionaries that map keys to values. Some languages also distinguish types that can hold nothing at all — a missing value, an empty field, an unknown — from types that always hold something. That distinction matters more than beginners expect, because "zero" and "unknown" are not the same thing.
Read more
Static, dynamic, and everything between
In some languages the type of every variable is declared and checked before the program runs; in others it is worked out as the code executes. Neither approach is inherently better. Strict checking catches mistakes early but demands more upfront description; flexible typing allows faster experimentation but pushes errors to the moment of use. Many modern languages sit in between, inferring types where they are obvious and letting you annotate where clarity helps.
The statistical view
Data analysts often use a parallel vocabulary. Nominal data is unordered labels, such as colours or city names. Ordinal data has a meaningful order without a fixed distance between steps, like a satisfaction rating. Interval data has consistent gaps but an arbitrary zero, as with temperature in degrees. Ratio data has both consistent gaps and a true zero, as with height or weight. The distinction decides which summaries and charts make sense: an average of nominal labels is meaningless, and ratios of interval values mislead.
Practical habits
Name and type your fields deliberately before filling them in. Keep a single type per column, rather than mixing numbers and text in one place. Store dates as dates. Be explicit about units and about how missing values are recorded. When converting between types, check what happens to the edges — rounding, truncation, overflow, silent failure — because those edges are where data quietly goes wrong.
None of this requires memorising a specification. It requires noticing that the category you assign to a value is a small promise about how it will behave later, and that keeping those promises consistent is most of the work.