deephaven.numpy

This module supports the conversion between Deephaven tables and numpy arrays.

to_np_busdaycalendar(cal, include_partial=True)[source]

Creates a numpy business day calendar from a Java BusinessCalendar.

Partial holidays in the business calendar are interepreted as full holidays in the numpy business day calendar.

Parameters:
  • cal (BusinessCalendar) – the Java BusinessCalendar

  • include_partial (bool) – whether to include partial holidays in the numpy business day calendar, default is True

Return type:

busdaycalendar

Returns:

a numpy busdaycalendar

Raises:

DHError

to_numpy(table, cols=None)[source]

Produces a numpy array from a table.

Note that the entire table is going to be cloned into memory, so the total number of entries in the table should be considered before blindly doing this. For large tables, consider using the Deephaven query language to select a subset of the table before using this method.

Parameters:
  • table (Table) – the source table

  • cols (Optional[Sequence[str]]) – the names of the columns; if None, all columns are included, default is None

Return type:

ndarray

Returns:

a numpy ndarray

Raises:

DHError

to_table(np_array, cols)[source]

Produces a Deephaven table from a numpy array.

Parameters:
  • np_array (np.ndarray) – a numpy array

  • cols (Sequence[str]) – a sequence of column names

Return type:

Table

Returns:

a Deephaven table

Raises:

DHError