> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nrev.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Code

> Run simple Python on your data—great for quick transformations, filters, or cleanups that aren’t yet available via built-in nodes.

## What It Does

* **Applies Python logic** to reshape, filter, or enrich your data
* **Great for edge cases** where no standard node (yet!) exists
* **Executes safely** and returns updated data just like any other node
* **Ideal for RevOps, GTM, and CS teams** who need a little extra power

***

## 🏁 Getting Started

<Frame>
  <img src="https://mintcdn.com/nurturev/OitEIaKlfl7lCKCJ/images/Custom%20Code%20node%20configuration%20screenshot.png?fit=max&auto=format&n=OitEIaKlfl7lCKCJ&q=85&s=d8f5963a5de3da1b598d27e18810b523" alt="Custom Code node configuration screenshot" style={{ borderRadius: '0.5rem', width: '100%', margin: '1.5rem 0' }} width="1178" height="1664" data-path="images/Custom Code node configuration screenshot.png" />
</Frame>

<Steps>
  <Step title="Add the Node">
    Drop **Custom Code** anywhere you need more control.
  </Step>

  <Step title="Connect an Input">
    Choose any upstream table you want to transform.
  </Step>

  <Step title="Write Your Code">
    Your data is already loaded as `df`. Edit and manipulate it as needed.
  </Step>

  <Step title="Run the Node">
    Hit **Run** — your logic is applied row-by-row.
  </Step>
</Steps>

***

## Inputs

### 🛠️ Required

* **Python Code (✅)**\
  Simple Python edits applied to your `df`.\
  *Why it matters:* This is where your logic lives — whether filtering rows, scoring leads, or cleaning fields.

<Note>⚠️ Invalid code will throw an error, and the node will not run until fixed.</Note>

***

## Output

* Your updated data, transformed exactly how your logic says
* All original columns are preserved unless you overwrite them
* You can keep building off this output downstream

***

## 🚀 Example Use Cases

| Use Case          | Code Snippet                                         |
| ----------------- | ---------------------------------------------------- |
| Add a column      | `df['is_target'] = df['industry'] == 'SaaS'`         |
| Clean up names    | `df['name'] = df['name'].str.title().str.strip()`    |
| Filter rows       | `df = df[df['region'] == 'North America']`           |
| Create lead score | `df['score'] = df['revenue'] / df['employee_count']` |

***

## ✨ Pro Tips

<Tip>
  Use this node **only when a built-in node doesn’t meet your need** — it keeps flows simpler and more scalable.
</Tip>

<Tip>
  Leverage our AI configurer to generate code. You don't have to do it all yourself!
</Tip>

<Tip>
  Start small — even a one-liner can save hours of spreadsheet work later.
</Tip>

<Tip>
  Use the toggle button to switch between test mode (**purple**) and full mode (**green**).\
  Test mode runs your code on just the first 5 rows — great for testing your logic before applying it across the full dataset.
</Tip>

***

## ⚠️ Considerations

<Warning>
  Broken code = node won’t run. The UI will surface any syntax issues immediately.
</Warning>

<Warning>
  Only use this node for scenarios we don’t already support — we’re constantly adding more built-in nodes to make your life easier.
</Warning>

<Warning>
  Be mindful when renaming or dropping fields — changes persist downstream.
</Warning>

***

## 📝 FAQ

<AccordionGroup>
  <Accordion title="What’s `df`?">
    It’s your input data — a DataFrame you can write Python against.
  </Accordion>

  <Accordion title="Do I need to be a developer?">
    Nope. If you can describe the logic, you can usually get AI tools to write it for you.
  </Accordion>

  <Accordion title="Why not just use this for everything?">
    Built-in nodes are faster, safer, and easier to maintain. Use code only when necessary.
  </Accordion>
</AccordionGroup>

***

## 💰 Pricing

> This node is **free** — no credits required.

***

<p style={{ fontSize: '1rem', fontWeight: 'bold', marginTop: '1.5rem' }}>
  Use code only when you need it. Custom Code gives you flexibility — but we’re always building smarter nodes to save you the trouble.
</p>
