dtype

Replacement of nptyping.typing_

In the transition away from using nptyping, we want to allow for greater control of dtype specifications - like different precision modes, etc. and allow for abstract specifications of dtype that can be checked across interfaces.

This module also allows for convenient access to all abstract dtypes in a single module, rather than needing to import each individually.

Some types like Integer are compound types - tuples of multiple dtypes. Check these using in rather than ==. This interface will develop in future versions to allow a single dtype check.

For internal helper functions for validating dtype, see numpydantic.validation.dtype

class datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])[source]

The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

hour
minute
second
microsecond
tzinfo
fold
classmethod fromtimestamp()

timestamp[, tz] -> tz’s local time from POSIX timestamp.

classmethod utcfromtimestamp()

Construct a naive UTC datetime from a POSIX timestamp.

classmethod now(tz=None)

Returns new datetime object representing current time local to tz.

tz

Timezone object.

If no tz is specified, uses local timezone.

classmethod utcnow()

Return a new datetime representing UTC day and time.

classmethod combine()

date, time -> datetime with same date and time fields

classmethod fromisoformat()

string -> datetime from a string in most ISO 8601 formats

timetuple()

Return time tuple, compatible with time.localtime().

timestamp()

Return POSIX timestamp as float.

utctimetuple()

Return UTC time tuple, compatible with time.localtime().

date()

Return date object with same year, month and day.

time()

Return time object with same time but with tzinfo=None.

timetz()

Return time object with same time and tzinfo.

replace()

Return datetime with new specified fields.

astimezone()

tz -> convert to local time in new timezone tz

ctime()

Return ctime() style string.

isoformat()

[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to ‘T’. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’ and ‘microseconds’.

classmethod strptime()

string, format -> new datetime parsed from a string (like time.strptime()).

utcoffset()

Return self.tzinfo.utcoffset(self).

tzname()

Return self.tzinfo.tzname(self).

dst()

Return self.tzinfo.dst(self).

max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
min = datetime.datetime(1, 1, 1, 0, 0)
resolution = datetime.timedelta(microseconds=1)
ShapeExpression

alias of str

StructureExpression

alias of str

Bool

alias of bool

Obj

alias of object_

Object

alias of object_

Datetime64

alias of datetime64

Inexact

alias of inexact

Int8

alias of int8

Int16

alias of int16

Int32

alias of int32

Int64

alias of int64

Byte

alias of int8

Short

alias of int16

IntC

alias of int32

IntP

alias of int64

Int_

alias of int64

UInt8

alias of uint8

UInt16

alias of uint16

UInt32

alias of uint32

UInt64

alias of uint64

UByte

alias of uint8

UShort

alias of uint16

UIntC

alias of uint32

UIntP

alias of uint64

UInt

alias of uint64

ULongLong

alias of ulonglong

LongLong

alias of longlong

Timedelta64

alias of timedelta64

SignedInteger = (<class 'numpy.int8'>, <class 'numpy.int16'>, <class 'numpy.int32'>, <class 'numpy.int64'>, <class 'numpy.int16'>)

Signed integer types

UnsignedInteger = (<class 'numpy.uint8'>, <class 'numpy.uint16'>, <class 'numpy.uint32'>, <class 'numpy.uint64'>, <class 'numpy.uint16'>)

Unsigned integer types

Integer = (<class 'numpy.int8'>, <class 'numpy.int16'>, <class 'numpy.int32'>, <class 'numpy.int64'>, <class 'numpy.int16'>, <class 'numpy.uint8'>, <class 'numpy.uint16'>, <class 'numpy.uint32'>, <class 'numpy.uint64'>, <class 'numpy.uint16'>)

All integer types

Float16

alias of float16

Float32

alias of float32

Float64

alias of float64

Half

alias of float16

Single

alias of float32

Double

alias of float64

LongDouble

alias of longdouble

Float = (<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.float32'>, <class 'numpy.float64'>)

All numpy float types

Floating = (<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.float32'>, <class 'numpy.float64'>)

Alias to Float

Complex64

alias of complex64

Complex128

alias of complex128

CSingle

alias of complex64

CDouble

alias of complex128

CLongDouble

alias of clongdouble

Flexible

alias of flexible

Void

alias of void

Character

alias of character

Bytes

alias of bytes_

Str

alias of str_

String

alias of str_

Unicode

alias of str_