to_numpy
The to_numpy
method produces a NumPy array from a table.
caution
to_numpy
copies the entire source table into memory. For large tables, consider limiting table size before using to_numpy
.
info
All of the columns in the table must have the same type. If the table contains columns with different types, to_numpy
will raise an exception.
Syntax
to_numpy(table: Table, cols: List[str]) -> numpy.ndarray
Parameters
Parameter | Type | Description |
---|---|---|
table | Table | The source table to convert to a |
cols | List[str] | The names of columns in the source table to be included in the result. The default is |
Returns
A numpy.ndarray
from the given Java array and the Table column definition.
Examples
In the following example, we create a basic Deephaven table and convert it to a numpy.ndarray
, then print the result.
from deephaven import empty_table
from deephaven.numpy import to_numpy
source = empty_table(10).update(["X = i", "Y = i * 2"])
np_result = to_numpy(source)
print(np_result)
- source
- Log