mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-14 15:52:26 +00:00
The pages describing this code lived in lancedb/docs, a repository with ten stars that neither contributing guide mentioned. A user who hit a wrong page while reading the source had to find a separate, near-invisible repository to fix it. These 102 pages now sit beside the code, and a documentation fix is a pull request in the repository the reader already had open. `docs/web` is a complete Mintlify site: `cd docs/web && mint dev` serves it with no other checkout. Enterprise pages stay private and are merged in when the published site is assembled, so links into them do not resolve here — every open-source page does. `docs/web-tests` holds the tests the code examples are extracted from. They ran against a published wheel before; here they can run against this repository's own SDK, so an example that stops compiling fails the pull request that broke it rather than being noticed later. Both directories sit beside `docs/src` and are invisible to it: mkdocs reads `docs_dir: src`, so the SDK reference builds and deploys exactly as before.
47 lines
1.5 KiB
Plaintext
47 lines
1.5 KiB
Plaintext
---
|
|
title: "Pandas and PyArrow"
|
|
sidebarTitle: "Pandas & PyArrow"
|
|
|
|
---
|
|
|
|
import {
|
|
PyPlatformsPandasAsyncExample,
|
|
PyPlatformsPandasCreateTable,
|
|
PyPlatformsPandasImports,
|
|
PyPlatformsPandasVectorSearch,
|
|
} from '/snippets/integrations.mdx';
|
|
|
|
Because Lance is built on top of [Apache Arrow](https://arrow.apache.org/),
|
|
LanceDB fits naturally into Pandas-first workflows. You can ingest a `DataFrame`,
|
|
query it with LanceDB's vector operators, and keep working in Pandas without any glue code.
|
|
|
|
## Create a dataset {#create-a-dataset}
|
|
|
|
Start by importing LanceDB alongside your usual Pandas utilities and connect to a temporary database.
|
|
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyPlatformsPandasImports}
|
|
</CodeBlock>
|
|
|
|
Use the familiar `pd.DataFrame` API to prepare your rows, then pass the entire frame to `db.create_table`.
|
|
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyPlatformsPandasCreateTable}
|
|
</CodeBlock>
|
|
|
|
## Vector search {#vector-search}
|
|
|
|
Queries can return Pandas frames as well, so you can immediately inspect the results or pipe them into downstream analytics.
|
|
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyPlatformsPandasVectorSearch}
|
|
</CodeBlock>
|
|
|
|
## Async API {#async-api}
|
|
|
|
For web services or background jobs that already rely on `asyncio`, use the asynchronous helpers to keep everything non-blocking.
|
|
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyPlatformsPandasAsyncExample}
|
|
</CodeBlock>
|