atoti.Session.read_numpy()#
- Session.read_numpy(array, /, *, columns, table_name, keys=(), partitioning=None, types={}, default_values={})#
Read a NumPy 2D array into a new table.
- Parameters:
array (ndarray[Any, dtype[Any]]) – The NumPy 2D ndarray to read the data from.
columns (Collection[str]) – The names to use for the table’s columns. They must be in the same order as the values in the NumPy array.
table_name (str) – The name of the table to create.
keys (Collection[str]) –
The columns that will become keys of the table.
Inserting a row containing key values equal to the ones of an existing row will replace the existing row with the new one.
Key columns cannot have
None
as theirdefault_value
.partitioning (str | None) –
The description of how the data will be split across partitions of the table.
Default rules:
Only non-joined tables are automatically partitioned.
Tables are automatically partitioned by hashing their key columns. If there are no key columns, all the dictionarized columns are hashed.
Joined tables can only use a sub-partitioning of the table referencing them.
Automatic partitioning is done modulo the number of available cores.
Example
hash4(country)
splits the data across 4 partitions based on the country column’s hash value.types (Mapping[str, DataType]) – Types for some or all columns of the table. Types for non specified columns will be inferred from numpy data types.
default_values (Mapping[str, ConstantValue | None]) – Mapping from column name to column
default_value
.
- Return type: