# KDB-X Python Overview

_This page provides a high-level overview of KDB-X Python (formerly known as PyKX), the official Python interface to KDB-X. It introduces its purpose, benefits, modes of operation, and how it fits into the wider KDB-X platform._

## What is KDB-X Python?

KDB-X Python is a **Python-native library** that bridges Python applications with the KDB-X core. It gives Python developers seamless access to q and kdb+ functionality, combining Python’s rich ecosystem of libraries (NumPy, Pandas, PyArrow, PyTorch, TensorFlow, scikit-learn, etc.) with KDB-X’s **high-performance time-series database and vector analytics engine**.

Originally released as **PyKX**, the library has now been aligned as part of the KDB-X ecosystem. This ensures tighter integration, consistent APIs, and a clearer path for users adopting KDB-X in Python-centric workflows.

## Why use KDB-X Python?

- **Python-first design** – Write and run Python code that directly manipulates q objects and tables. No need to switch context between languages.  
- **Unified data pipeline** – Effortlessly move between q objects and familiar Python types (NumPy arrays, Pandas DataFrames, PyArrow Tables).  
- **Performance at scale** – Push heavy analytical workloads into the KDB-X engine while orchestrating logic from Python.  
- **Machine learning and AI integration** – Combine Python’s ML/AI frameworks with high-frequency, large-scale time-series data from KDB-X.  
- **Rapid prototyping** – Test and validate ideas in Python, while still leveraging q’s performance for production workloads.  

## Modes of operation

KDB-X Python supports multiple execution and connectivity modes to suit different environments, governed in part by licensing:

- **Embedded (within Python).** When licensed, KDB-X Python can embed q directly within the Python process. This gives the lowest-latency interaction and is ideal for analytic pipelines or ML loops needing tight coupling.  

- **IPC (inter-process communication).** Connect to remote or local q processes via IPC. Unlicensed mode uses only IPC and cannot embed q; licensed mode supports full IPC communication with richer type conversions.

- **Python under q.** In this mode, Python runs inside a q host process, allowing q-based scripts to call Python. This is useful when workflows originate from q and require Python extensions.

- **Hybrid workflows.** You may mix embedded and IPC modes. For example, embed q for local vector operations, but query large datasets remotely via IPC.

## Key use cases

- **Data science and ML pipelines** – Retrieve and preprocess large time-series datasets in q, then pass them into NumPy/Pandas/TensorFlow for analysis or modeling.  
- **Interactive analytics** – Explore financial, IoT, or telemetry data interactively in Python notebooks, while leveraging q for heavy lifting.  
- **Production pipelines** – Orchestrate streaming ingestion, enrichment, and analytics in Python with calls to KDB-X for persistence and queries.  
- **Interoperability** – Move seamlessly between Arrow, Pandas, and q tables to integrate with the broader data stack.  

## How it fits into KDB-X

- KDB-X Python is distributed as a **module** within the KDB-X library ecosystem.  
- It builds directly on the **KDB-X core**, exposing q types, functions, and the runtime to Python.  
- It works alongside other KDB-X modules (such as Parquet, Kafka connectors, or ML modules) to create end-to-end data pipelines in Python.  
- It lowers the barrier for Python developers to use KDB-X by providing idiomatic APIs and familiar data structures.  

## Benefits for developers and teams

- **For Python developers**: Immediate access to KDB-X’s speed and time-series capabilities without needing to learn q in depth.  
- **For q developers**: Ability to embed Python logic into KDB-X workflows, unlocking access to the Python ecosystem.  
- **For organizations**: A unified way to connect time-series data pipelines and analytics with modern ML/AI workloads.

## Next steps

- [Install KDB-X Python](https://code.kx.com/pykx/getting-started/installing.html) to set up the library in your environment.  
- [Quickstart guide](https://code.kx.com/pykx/getting-started/quickstart.html) to get up and running quickly.  
- [Migrate from PyKX to KDB-X Python](https://code.kx.com/pykx/upgrades/3040.html) to update existing projects.  
- Explore the full [KDB-X Python documentation site](https://code.kx.com/pykx/) for tutorials, references, [release notes](https://code.kx.com/pykx/release-notes/changelog.html), and advanced use cases.
