⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k
DuckDB 2.0 ドキュメント 全文検索
per page, with , order by , clip by
Results of 1 - 5 of about 5 for fetchnumpy (0.003 sec.)
Export to Numpy 12170
The result of a query can be converted to Numpy arrays using the fetchnumpy() function, which returns a dictionary that maps each column name to a Numpy array. For example: import duckdb import numpy as np my_arr = duckdb.sql("SELECT unnest ... ([1, 2, 3]) AS x, 5.0 AS y").fetchnumpy() my_arr {'x': array([1, 2, 3], dtype=int32), 'y': array([5., 5., 5.])} Then, the array can be processed using Numpy funct ...
https://man.mtool.work/duckdb/2.0/guides/python/export_numpy.html
Conversion between DuckDB and Python 10387
This page documents the rules for converting DuckDB results to Python and Python objects to DuckDB . Result Conversion: DuckDB Results to Python A result is read from a relation or, when using the DB-API / con.execute() , from the connectio ... n tuples fetchall() , iter_rows(batch_size=1024) fetchone() , fetchmany(size=1) , fetchall() Python dicts to_dicts() NumPy fetchnumpy() fetchnumpy() Pandas df() df() , fetch_df_chunk() Apache Arrow to_arrow_table() , to_arrow_reader() to_arrow_table() , to ... or to_arrow_reader() instead. Note that with the DB-API, after a partial read with fetchone() or fetchmany() , the df() , fetchnumpy() and Arrow methods of the connection return only the remaining rows. Examples Below are some examples. See the Python gui ... 000.0 1 3 chainsaw 500.0 10 4 iphone 300.0 2 Fetch as dictionary of NumPy arrays: arr = con.execute("SELECT * FROM items").fetchnumpy() print(arr) {'item': array(['jeans', 'hammer', 'laptop', 'chainsaw', 'iphone'], dtype=object), 'value': array([ 20. , 42. ...
https://man.mtool.work/duckdb/2.0/clients/python/conversion.html
Python DB API 8438
The standard DuckDB Python API provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249 similar to the SQLite Python API . Connection To use the module, you must first create a DuckDBPyConnection object that ... left. fetchmany(size) returns a list of at most size rows, one by default. fetchall() returns all remaining rows. df() and fetchnumpy() return the remaining rows as a pandas DataFrame or as NumPy arrays. Below are some short examples: import duckdb con = d ... o its end inside execute() . The result of a query stays open until a fetch returns no rows, or until fetchall() , df() or fetchnumpy() reads the rest of it. After a partial read with fetchone() or fetchmany() , these methods return the rows not fetched ye ...
https://man.mtool.work/duckdb/2.0/clients/python/dbapi.html
Python API 7556
Installation To use the DuckDB Python client, visit the Python installation page . The latest stable version of the DuckDB Python client is 2.0.0. Installation The DuckDB Python API can be installed using pip : pip install duckdb . Please s ... to_arrow_table() # Arrow Table duckdb.sql("SELECT 42").to_arrow_reader() # Arrow RecordBatchReader duckdb.sql("SELECT 42").fetchnumpy() # NumPy Arrays Writing Data to Disk DuckDB supports writing Relation objects directly to disk in a variety of formats. T ...
https://man.mtool.work/duckdb/2.0/clients/python/overview.html
Python Client API 7372
Connection class duckdb. Appender Bases: object append_row ( self , * args ) → None Buffer one row, one value per column, each converted as an executemany parameter would be append_rows ( self , rows : object ) → None Buffer each row of an ... following execute() fetchmany ( self , size : int = 1 ) → list Fetch the next set of rows from a result following execute fetchnumpy ( self ) → dict Fetch a result as list of NumPy arrays following execute fetchone ( self ) → object Fetch a single row fro ... = False ) → Any Execute and fetch all rows as a pandas DataFrame. Detailed examples can be found at Relational API page . fetchnumpy ( ) → dict [ str , Any ] Execute and fetch all rows as a Python dict mapping each column to one numpy arrays. Detailed exa ... ion : _duckdb.DuckDBPyConnection | None = None ) → list Fetch the next set of rows from a result following execute duckdb. fetchnumpy ( * , connection : _duckdb.DuckDBPyConnection | None = None ) → dict Fetch a result as list of NumPy arrays following exec ...
https://man.mtool.work/duckdb/2.0/clients/python/reference/
PREV 1 NEXT
DuckDB 2.0 Documentation / man.mtool.work