Results of 1 - 10 of about 11 for shape (0.003 sec.)
- Struct Functions 13069
- The functions on this page work on STRUCT values . Functions that access entries by position, such as struct[idx] , struct_extract_at , struct_contains , struct_position and struct_values , also accept TUPLE values , i.e., structs with unna
...sing an index (1-based). remap_struct(input, target_type, mapping, defaults) Remap a STRUCT , LIST , or MAP value into the shape given by the type of target_type , renaming and reordering fields, descending into nested types, and filling missing field...struct(input, target_type, mapping, defaults) | Description | Remap an input value of type STRUCT , LIST , or MAP into the shape declared by the type of target_type , renaming and reordering fields, descending into nested types, and filling target fie...he desired type works; a typed NULL literal (e.g. NULL::STRUCT(v1 INT, v2 INT) ) is a convenient way to declare the target shape when no suitable value is at hand. mapping is a STRUCT keyed by target field name whose values name the source field to re... - https://man.mtool.work/duckdb/2.0/sql/functions/struct.html
- Star Expression 10526
- Syntax The * expression can be used in a SELECT statement to select all columns that are projected in the FROM clause. SELECT * FROM tbl; TABLE.* and STRUCT.* The * expression can be prepended by a table name to select only columns from tha
...all keys from a struct as separate columns. This is particularly useful when a prior operation creates a struct of unknown shape, or if a query must handle any potential struct keys. See the STRUCT data type and STRUCT functions pages for more details...all keys from a struct as separate columns. This is particularly useful when a prior operation creates a struct of unknown shape, or if a query must handle any potential struct keys. See the STRUCT data type and STRUCT functions pages for more details... - https://man.mtool.work/duckdb/2.0/sql/expressions/star.html
- Integration with Polars 9691
- Polars is a DataFrames library built in Rust with bindings for Python and Node.js. It uses Apache Arrow's columnar format as its memory model. DuckDB can read Polars DataFrames and convert query results to Polars DataFrames. It does this in
...ckdb.sql(""" SELECT 1 AS id, 'banana' AS fruit UNION ALL SELECT 2, 'apple' UNION ALL SELECT 3, 'mango'""" ).pl() print(df) shape: (3, 2) ┌─────┬────────┐ │ id ┆ fruit │ │ --- ┆ --- │ │ i32 ┆ str │ ╞═════╪════════╡ │ 1 ┆ banana │ │ 2 ┆ apple │ │ 3 ┆ ma... - https://man.mtool.work/duckdb/2.0/guides/python/polars.html
- Integration with PyTorch 9691
- PyTorch tensors can be built from DuckDB query results by exporting each result batch as Apache Arrow . This pattern is useful when training or serving models on Parquet data because DuckDB can filter and project the input before the batche
...o_numpy(), ] ), dtype=torch.float32, ) labels = torch.tensor(batch.column(2).to_numpy(), dtype=torch.int64) print(features.shape, labels) torch.Size([2, 2]) tensor([1, 1]) DuckDB pushes the WHERE label = 1 filter and the selected columns into the data... - https://man.mtool.work/duckdb/2.0/guides/python/pytorch.html
- JSON Format Settings 9264
- The JSON extension can attempt to determine the format of a JSON file when setting format to auto . Here are some example JSON files and the corresponding format settings that should be used. In each of the below cases, the format setting w
...as not needed, as DuckDB was able to infer it correctly, but it is included for illustrative purposes. A query of this shape would work in each case: SELECT * FROM filename.json; Format: newline_delimited With format = 'newline_delimited' newline-... - https://man.mtool.work/duckdb/2.0/data/json/format_settings.html
- Export to Apache Arrow 8837
- All results of a query can be exported to an Apache Arrow Table using the to_arrow_table function. Alternatively, results can be returned as a RecordBatchReader using the to_arrow_reader function and results can be read one batch at a time.
...ROM range(3) AS t(i)") print(pa.table(rel).to_pydict()) print(pl.DataFrame(rel)) {'i': [0, 1, 2], 's': ['v0', 'v1', 'v2']} shape: (3, 2) ┌─────┬─────┐ │ i ┆ s │ │ --- ┆ --- │ │ i64 ┆ str │ ╞═════╪═════╡ │ 0 ┆ v0 │ │ 1 ┆ v1 │ │ 2 ┆ v2 │ └─────┴─────┘... - https://man.mtool.work/duckdb/2.0/guides/python/export_arrow.html
- Run Queries 8001
- Overview Because the Go client implements database/sql , queries run through the standard methods: Exec and ExecContext send statements that do not return rows, such as INSERT or DDL, and report the number of affected rows. Query , QueryCon
...its JSON type, are scanned through the generic duckdb.Composite[T] wrapper. Choose the Go type parameter to match the SQL shape, then read the decoded value with Get() : // A JSON (or LIST) value read into a slice. var arr duckdb.Composite[[]any] row... - https://man.mtool.work/duckdb/2.0/clients/go/querying.html
- Aggregate Functions 7575
- Examples Produce a single row containing the sum of the amount column: SELECT sum(amount) FROM sales; Produce one row per unique region, containing the sum of amount for each group: SELECT region, sum(amount) FROM sales GROUP BY region; Ret
...SELECT first(amount ORDER BY date ASC) FROM sales; Downsample a series of 100 points to 5 points that preserve its visual shape using the lttb() aggregate function : SELECT unnest(lttb(x, sin(x), 5 ORDER BY x)) AS point FROM range(0, 100) t(x); ┌────...s to at most n representative points using the Largest-Triangle-Three-Buckets (LTTB) algorithm, which preserves the visual shape of the series. Returns a LIST of STRUCT s with fields x and y , always including the first and the last point. x and y eac... - https://man.mtool.work/duckdb/2.0/sql/functions/aggregates.html
- Relational API 7148
- The Relational API builds a query one step at a time from Python. A relation, a DuckDBPyRelation , is a piece of SQL text: the methods of the Transformation and Functions sections return a new relation whose text extends the one they were c
...n the view named virtual_table_name that refers to the relation object. set_alias Rename the relation object to new alias. shape Tuple of # of rows, # of columns in relation. show Display a summary of the data. sql_query Get the SQL query that is equi...│ jeans │ 20 │ │ t-shirt │ 8 │ │ jacket │ 65 │ │ hammer │ 42 │ │ screwdriver │ 7 │ │ drill │ 89 │ └─────────────┴───────┘ shape Tuple of # of rows, # of columns in relation. Example import duckdb duckdb_conn = duckdb.connect() rel = duckdb_conn.sql("...'screwdriver', 'tools', 7, TRUE), (6, 'drill', 'tools', 89, TRUE) ) AS items(id, item, category, price, in_stock) """) rel.shape Result (6, 5) show show(self, *, max_width: int | None = None, max_rows: int | None = None, max_col_width: int | None = No... - https://man.mtool.work/duckdb/2.0/clients/python/relational_api.html
- Struct Data Type 7148
- Conceptually, a STRUCT column contains an ordered list of columns called “entries”. The entries are referenced by name using strings. This document refers to those entry names as keys. Each row in the STRUCT column must have the same keys.
...all keys from a struct as separate columns. This is particularly useful when a prior operation creates a struct of unknown shape, or if a query must handle any potential struct keys: SELECT unnest(a) FROM (SELECT {'x': 1, 'y': 2, 'z': 3} AS a); x y z... - https://man.mtool.work/duckdb/2.0/sql/data_types/struct.html
DuckDB 2.0 Documentation / man.mtool.work