# Calendar Year

Key: `datetime.component.year`

Four-digit year. Ambiguous as a standalone value — could be any integer. Column-mode inference checks range and distribution.

Page: <https://meridian.online/docs/projects/finetype/types/datetime/component/year>

Samples: `2024`, `1999`, `2000`

## Background

### Origin

ISO 8601 requires a year to be written with at least four digits, covering the years 0000 to 9999.[[1]](https://en.wikipedia.org/wiki/ISO_8601) The first edition of ISO 8601 was published as ISO 8601:1988 in June 1988.[[1]](https://en.wikipedia.org/wiki/ISO_8601) ISO 8601 says that year values from 0000 through 1582 shall only be used by mutual agreement of the partners in information interchange.[[1]](https://en.wikipedia.org/wiki/ISO_8601)

The Year 2000 problem arose because many programs represented four-digit years with only the final two digits, making the year 2000 indistinguishable from 1900.[[2]](https://en.wikipedia.org/wiki/Year_2000_problem) The four-digit year is the plain lesson of that episode: two digits save space and leave the century to guesswork. (Meridian's view)

W3C's XML Schema datatypes specification defines gYear as a datatype that represents Gregorian calendar years.[[3]](https://www.w3.org/TR/xmlschema11-2/) The Frictionless Data Table Schema defines a year field type as a calendar year as per XMLSchema gYear.[[4]](https://specs.frictionlessdata.io/table-schema/) The Frictionless Data Table Schema gives YYYY as the usual lexical representation of a year field, with no format options.[[4]](https://specs.frictionlessdata.io/table-schema/)

### Use

MySQL has a YEAR type, a 1-byte type used to represent year values.[[5]](https://dev.mysql.com/doc/refman/8.0/en/year.html) MySQL displays YEAR values in YYYY format, with a range of 1901 to 2155, and 0000.[[5]](https://dev.mysql.com/doc/refman/8.0/en/year.html) MySQL converts two-digit year strings from '0' to '69' into the years 2000 to 2069, and strings from '70' to '99' into 1970 to 1999.[[5]](https://dev.mysql.com/doc/refman/8.0/en/year.html) A two-digit year in a source file is a guess about the century, so find out which pivot rule produced or will read it before you trust it. (Meridian's view)

The pandas documentation explains that because NaN is a float, an array of integers with any missing values is forced to become floating point.[[6]](https://pandas.pydata.org/docs/user_guide/integer_na.html) If a year column reads 2024.0, suspect a float conversion somewhere upstream and drop the fraction before casting the column to a whole number. (Meridian's view)

A four-digit number on its own could just as well be a count, a code or a price, so check a column's name and its range of values before treating it as a year. (Meridian's view)

### Where you'll meet it

Our World in Data's life expectancy CSV download carries a year column of four-digit values such as 1950, beside entity, code and life expectancy columns.[[7]](https://ourworldindata.org/grapher/life-expectancy.csv?v=1&csvType=full&useColumnShortNames=true)

## Sources

1. [ISO 8601 - Wikipedia](https://en.wikipedia.org/wiki/ISO_8601) — secondary source
2. [Year 2000 problem - Wikipedia](https://en.wikipedia.org/wiki/Year_2000_problem) — secondary source
3. [W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes](https://www.w3.org/TR/xmlschema11-2/) — standard
4. [Table Schema \| Data Package (v1)](https://specs.frictionlessdata.io/table-schema/) — standard
5. [MySQL :: MySQL 8.0 Reference Manual :: 13.2.4 The YEAR Type](https://dev.mysql.com/doc/refman/8.0/en/year.html) — documentation
6. [Nullable integer data type — pandas 3.0.6 documentation](https://pandas.pydata.org/docs/user_guide/integer_na.html) — documentation
7. [Life expectancy](https://ourworldindata.org/grapher/life-expectancy.csv?v=1&csvType=full&useColumnShortNames=true) — dataset
