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 (List[str]) – the source column names, default is None which means include all columns

Return type:

ndarray

Returns:

a numpy ndarray

Raises:

DHError

to_table(np_array, cols)[source]

Creates a new table from a numpy array.

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

  • cols (List[str]) – the table column names that will be assigned to each column in the numpy array

Return type:

Table

Returns:

a Deephaven table

Raises:

DHError