Data Type
A data type defines what kind of value a variable, field, or piece of data can hold and what operations are valid on it — integer, floating-point number, string, boolean, date — and it is one of the first structural decisions made about any piece of data, usually before a single analysis has run. The concept exists at two levels that are easy to conflate: the programming-language or database sense, where a data type is a technical classification (int, varchar, timestamp) that determines how a value is stored in memory and what code can legally do with it; and the statistical sense, where variables are typed by their measurement properties (quantitative or categorical, and the finer distinctions beneath each) regardless of how they happen to be stored. A field can be stored as an integer in a database while statistically functioning as a categorical variable — a product category coded 1 through 5 is still categorical even though the database type is numeric, and treating it as quantitative because of its storage type is a direct route to a meaningless average.
In the statistical sense, data types form a nested hierarchy, and getting the classification right determines which charts, summary statistics, and tests are valid to use. The top-level split is quantitative versus categorical. Quantitative data splits further into discrete (countable, taking distinct separate values — number of children, number of defects) and continuous (measurable on an unbroken scale — height, temperature, time). Categorical data splits into nominal (categories with no inherent order — color, country) and ordinal (categories with a meaningful order but no fixed numeric distance between them — survey ratings of "poor," "fair," "good," "excellent"). The hierarchy matters because each level licenses different operations: you can compute a meaningful average on continuous data, a meaningful median on ordinal data, but only a mode on nominal data, since nominal categories have no natural ordering to average or rank.
In the programming and database sense, data types exist primarily to tell the system how much memory to allocate and what operations are permitted, and type mismatches are one of the most common classes of bugs in data pipelines. Static-typed languages and databases enforce a field's type at write time — SQL rejects inserting the string "abc" into an integer column outright. Dynamically typed languages like Python infer a value's type at runtime, which gives more flexibility but shifts the burden of catching type errors to testing and runtime checks rather than the compiler or database engine. A single pipeline moving data between a loosely typed source (JSON, CSV) and a strictly typed destination (a SQL warehouse) routinely hits type coercion failures — a numeric-looking field that's actually stored as text, a date in an unexpected format — which is why explicit schema validation at ingestion has become standard practice in data engineering rather than trusting that types will simply line up.
Type conversion (casting) — explicitly changing a value from one data type to another — is routine and usually safe when going from a narrower type to a wider one (an integer to a float loses nothing) but risky and potentially lossy in the other direction (a float truncated to an integer silently drops its decimal portion). The same risk appears when converting categorical data to numeric codes for use in a model: encoding "red," "green," "blue" as 0, 1, 2 technically works but implicitly introduces a false ordinal relationship (the model may learn that "blue" is "greater than" red in a way that has no real meaning), which is why one-hot encoding — representing each category as its own binary column rather than a single ordered number — is the standard fix for nominal categorical data fed into most machine learning algorithms.
Null or missing values interact with data type in a way that trips up a specific and common class of bug: a numeric column containing even a single null, in many systems and languages, gets silently upcast to a floating-point type, because integer types traditionally have no representation for "missing," while floats do (via NaN). A column of whole-number counts that should display as 5, 10, 15 instead displays as 5.0, 10.0, 15.0 the moment a single null enters the column — a cosmetic-looking change that's actually a visible symptom of the missing-value handling happening underneath, and a common source of confusion for analysts who don't expect an integer column to change type based on something as seemingly unrelated as a missing row.
Read data type as the layer of structure that decides, before any analysis begins, what a piece of data is even allowed to mean: the statistical hierarchy of quantitative and categorical types governs what summary statistics and tests apply, the programming and database type system governs what operations and conversions are safe, and most of the quiet, hard-to-spot bugs in a data pipeline — a false average on categorical codes, a silently upcast integer column, a lossy truncation — trace back to a mismatch between the type a value is stored as and the type it's actually being treated as.