Statistics for AI Engineering: A Four-Hour Course Walkthrough
#Data Types
1 ideas
Statistics for AI Engineering: A Four-Hour Course Walkthrough
Get new #Data Types ideas by email
Every Thursday: the week's best ideas, with the newest from #Data Types.
Related tags
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.
#Data Types: frequently asked questions
How do I get started with data types if I'm new to them?
Start by looking at the information you already handle and asking what kind of thing each piece is: a whole count, a decimal measurement, a piece of text, a yes-or-no flag, or a moment in time. Naming and typing your fields deliberately, before you fill them in, does most of the work. You don't need to memorise a language specification to begin — just notice that the category you pick is a small promise about how that value will behave later.
Which data type should I choose for a given value?
Choose the type that matches what the value actually is, not what it happens to look like today. Text that represents a date should be stored as a date, and money should use a dedicated decimal type rather than a float, because floats hold approximations and will drift. When in doubt, pick the more specific type and be explicit about units.
What's the difference between statically and dynamically typed languages?
In one style the type of every variable is declared and checked before the program runs; in the other it is worked out while the code executes. Neither is inherently better — strict checking catches mistakes early but asks for more upfront description, while flexible typing lets you experiment quickly and pushes errors to the moment of use. Many modern languages sit in between, inferring obvious types and letting you annotate where clarity helps.
How should I record missing or unknown values?
Treat a missing value as its own category rather than disguising it as a real value, because an unknown and a genuine empty or nothing-like entry are not the same thing. Decide in advance how your missing values are recorded and keep that convention consistent everywhere. Languages that separate types which can hold nothing from types that always hold something make this distinction easier to keep.
What are the common mistakes people make with data types?
Mixing numbers and text in a single column, storing dates as plain text, and letting units go unstated are among the most frequent slips. Another is ignoring what happens at the edges when converting between types — rounding, truncation, overflow, or silent failure — which is exactly where data quietly goes wrong. Keeping one type per field and being explicit about unit and missing values prevents most of it.
Do the statistical categories of data matter for everyday work?
They do, because they decide which summaries and charts make sense. Labels with no order can't sensibly be averaged, ordered ratings have gaps of unknown size, and values with a consistent scale but an arbitrary starting point shouldn't be used to compare ratios. Thinking in these terms keeps you from drawing conclusions the data can't support.
Videos come from YouTube and posts from Instagram; titles and summaries are our own. All rights belong to their creators.