# Pandas Query Component

The **Pandas query** component is designed to filter the data by applying pandas query on it.&#x20;

All component configurations are classified broadly into the following sections:

* ​[​Basic Information​](/data-pipeline-1/components/component-base-configuration.md)​
* Meta Information
* ​[Resource Configuration​](/data-pipeline-1/components/resource-configuration.md)​

{% hint style="success" %}
*Follow the steps given in the demonstration to configure the Pandas Query component.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fuq3RSHHup7fjHYaspk7y%2Fuploads%2FzlUuuTBMgpM47EpTLdaQ%2Fpandas%20query%20component%20(online-video-cutter.com).mp4?alt=media&token=b9c3282a-d21c-4f63-a1f9-53bc5cf34b46>" %}
Configuring the Pandas Query Component
{% endembed %}

## **Steps to Configure the Pandas Query Component**  <a href="#steps-to-configure-the-pandas-query-component" id="steps-to-configure-the-pandas-query-component"></a>

This component helps the users to get data as per the entered query.

* Drag and Drop the Pandas Query component to the Workflow Editor.

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FjwJshWI8bl4QBbw09u2K%2Fimage.png?alt=media&#x26;token=acdedb49-04f6-4b3a-905c-5041650eda4c" alt=""><figcaption><p>Drag the Transformation group</p></figcaption></figure>

* The transformation component requires an input event (to get the data) and sends the data to an output event.
* Create two Events and drag them to the Workspace.
* Connect the input event and the output event to the component (The data in the input event can come from any Ingestion, Reader, or shared events).

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FFDbBgS4IaoZdy36SX6ib%2Fimage.png?alt=media&#x26;token=131c3b19-1be3-445a-a41b-27df76c92507" alt=""><figcaption><p>Pandas Query Component</p></figcaption></figure>

* Click the Pandas Query component to get the component properties tabs.

### Basic Information Tab <a href="#basic-information-tab" id="basic-information-tab"></a>

The **Basic Information** tab opens by default while clicking the dragged component.

* Select an Invocation type from the drop-down menu to confirm the running mode of the Pandas Query component. Select ‘**Real-Time**’ or ‘**Batch**’ from the drop-down menu.
* **Deployment Type:** It displays the deployment type for the component. This field comes pre-selected.
* **Container Image Version**: It displays the image version for the docker container. This field comes pre-selected.
* **Failover Event**: Select a failover Event from the drop-down menu.
* **Batch Size (min 10)**: Provide the maximum number of records to be processed in one execution cycle (Min limit for this field is 10).

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FAc96fKKJFx4t0l0K4DHL%2Fimage.png?alt=media&#x26;token=25d690f4-93e1-46cf-968e-06fd8ca714df" alt=""><figcaption></figcaption></figure>

### Meta Information Tab <a href="#meta-information-tab" id="meta-information-tab"></a>

Open the **Meta Information** tab and provide the connection-specific detail&#x73;**.**

* Enter a valid data query to fetch data.
* Provide the Table Name.

Note: The table name and query DF should be the same.

### Saving the Component Configuration <a href="#saving-the-component-configuration" id="saving-the-component-configuration"></a>

* Click the **Save Component in Storage** icon to save the component properties.
* A Notification message appears to notify the successful update of the component.

![](https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2F8VuodkH0vV6yYl6XIX87%2Fimage.png?alt=media\&token=42f31951-c63a-4dcf-8abe-bd5d404d262f)​

{% hint style="info" %}
*<mark style="color:green;">Please Note</mark><mark style="color:green;">:</mark> The samples of Pandas Query are given below together with the SQL query for the same statements.*
{% endhint %}

### **Samples Query Examples**&#x20;

| **SQL Query**                                                                                                                | **Pandas Query**                                                                                                                                         |
| ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| select id from airports where ident = 'KLAX'                                                                                 | airports \[airports.ident == 'KLAX'].id                                                                                                                  |
| select \* from airport\_freq where airport\_ident = 'KLAX' order by type                                                     | airports\[(airports.iso\_region == 'US-CA') & (airports.type == 'seaplane\_base')]                                                                       |
| select type, count(\*) from airports where iso\_country = 'US' group by type having count(\*) > 1000 order by count(\*) desc | <p>airports\[airports.iso\_country == 'US'].groupby('type').filter(lambda g: len(g) > 1000).groupby('type').size().sort\_values(ascending=False)<br></p> |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bdb.ai/data-pipeline-1/components/transformations/pandas-query-component.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
