DateFormat
Source¶
Bases: Enum
Common orders in which dates are written as texts, used by TableConversion.
When reading, the day, the month and the year are separated by "/", "-" or ".", the same one twice;
days and months may have one digit, years have four. A _TIME member also needs the time, as "14:30"
or "14:30:15", after a space, or after a "T" for YEAR_MONTH_DAY_TIME. When writing, "/" separates
the day-month and month-day orders and "-" the year-month-day order, and the time is written "14:30:15".
Use CustomDateFormat for any other way of writing dates.
Added in version 0.1.0
Examples:
import numdaplot as ndp
days = ndp.Table.from_arrays({"day": ndp.Array.from_list(["31/12/2026", "1.2.2026"])})
days.convert(ndp.TableConversion(columns=["day"], dtype=ndp.Type.DATE, format=ndp.DateFormat.DAY_MONTH_YEAR))
# day
# DATE
# 0 2026-12-31
# 1 2026-02-01
Attributes¶
DAY_MONTH_YEAR = auto()
Source¶
The day, the month, then the year: "31/12/2026".
Added in version 0.1.0
Examples:
MONTH_DAY_YEAR = auto()
Source¶
The month, the day, then the year: "12/31/2026".
Added in version 0.1.0
Examples:
YEAR_MONTH_DAY = auto()
Source¶
The year, the month, then the day: "2026-12-31". Read by default when no format is given.
Added in version 0.1.0
Examples:
DAY_MONTH_YEAR_TIME = auto()
Source¶
The day, the month, the year, then the time: "31/12/2026 14:30".
Added in version 0.1.0
Examples:
MONTH_DAY_YEAR_TIME = auto()
Source¶
The month, the day, the year, then the time: "12/31/2026 14:30".
Added in version 0.1.0
Examples: