deephaven.dtypes

This module defines the data types supported by the Deephaven engine.

Each data type is represented by a DType class which supports creating arrays of the same type and more.

BigDecimal = java.math.BigDecimal

Java BigDecimal type

BigInteger = java.math.BigInteger

Java BigInteger type

BusinessCalendar = io.deephaven.time.calendar.BusinessCalendar

Business calendar type

Character = java.lang.Character

Character type

class DType(j_name, j_type=None, qst_type=None, is_primitive=False, np_type=<class 'numpy.object_'>)[source]

Bases: object

A class representing a data type in Deephaven.

Parameters:
  • j_name (str) – the full qualified name of the Java class

  • j_type (Type) – the mapped Python class created by JPY

  • qst_type (JType) – the JPY wrapped object for a instance of QST Type

  • is_primitive (bool) – whether this instance represents a primitive Java type

  • np_type (Any) – an instance of numpy dtype (dtype(“int64”) or numpy class (e.g. np.int16), default is np.object_

Duration = java.time.Duration

Time period type, which is a unit of time in terms of clock time (24-hour days, hours, minutes, seconds, and nanoseconds).

Instant = java.time.Instant

Instant date time type

JObject = java.lang.Object

Java Object type

LocalDate = java.time.LocalDate

Local date type

LocalTime = java.time.LocalTime

Local time type

Period = java.time.Period

Time period type, which is a unit of time in terms of calendar time (days, weeks, months, years, etc.).

PyObject = org.jpy.PyObject

Python object type

StringSet = io.deephaven.stringset.StringSet

Deephaven StringSet type

TimeZone = java.time.ZoneId

Time zone type.

ZonedDateTime = java.time.ZonedDateTime

Zoned date time type

array(dtype, seq, remap=None)[source]

Creates a Java array of the specified data type populated with values from a sequence.

Note

this method does unsafe casting, meaning precision and values might be lost with down cast

Parameters:
  • dtype (DType) – the component type of the array

  • seq (Sequence) – a sequence of compatible data, e.g. list, tuple, numpy array, Pandas series, etc.

  • remap (optional) – a callable that takes one value and maps it to another, for handling the translation of special DH values such as NULL_INT, NAN_INT between Python and the DH engine

Return type:

Optional[JType]

Returns:

a Java array

Raises:

DHError

bool_ = java.lang.Boolean

Boolean type

bool_array = [Z

boolean array type

boolean_array = [Ljava.lang.Boolean;

Java Boolean array type

byte = byte

Signed byte integer type

byte_array = [B

Byte array type

char = char

Character type

char_array = [C

char array type

double = double

Double-precision floating-point number type

double_array = [D

Double-precision floating-point array type

float32 = float

Single-precision floating-point number type

float32_array = [F

Single-precision floating-point array type

float64 = double

Double-precision floating-point number type

float64_array = [D

Double-precision floating-point array type

from_jtype(j_class)[source]

looks up a DType that matches the java type, if not found, creates a DType for it.

Return type:

Optional[DType]

from_np_dtype(np_dtype)[source]

Looks up a DType that matches the provided numpy dtype or Pandas’s nullable equivalent; if not found, returns PyObject.

Return type:

DType

instant_array = [Ljava.time.Instant;

Java Instant array type

int16 = short

Signed short integer type

int16_array = [S

Short array type

int32 = int

Signed 32bit integer type

int32_array = [I

32bit integer array type

int64 = long

Signed 64bit integer type

int64_array = [J

64bit integer array type

int8 = byte

Signed byte integer type

int8_array = [B

Byte array type

long = long

Signed 64bit integer type

long_array = [J

64bit integer array type

null_remap(dtype)[source]

Creates a null value remap function for the provided DType.

Parameters:

dtype (DType) – the DType instance

Return type:

Callable[[Any], Any]

Returns:

a Callable

Raises:

TypeError

short = short

Signed short integer type

short_array = [S

Short array type

single = float

Single-precision floating-point number type

single_array = [F

Single-precision floating-point array type

string = java.lang.String

String type

string_array = [Ljava.lang.String;

Java String array type

zdt_array = [Ljava.time.ZonedDateTime;

Zoned date time array type