---
updatedAt: 2026-02-16T15:06:07.000Z
agentTools:
  projectIndex: https://docs.phacetlabs.com/llms.txt
---

# Number

The Number column type lets you store **numeric values** in your Phacet: integers or decimals. Values can be entered manually, extracted from documents using AI, or computed with Python code.

Unlike Text columns, Number columns enforce a strict numeric format: only valid numbers (or empty values) are accepted. This ensures data consistency and makes your columns ready for calculations, comparisons, and aggregations.

**Example use cases**

* **Extract financial figures**: pull revenue, costs, or margins from contracts, invoices, or financial reports.
* **Score or rank records**: assign numeric scores to leads, applications, or risk assessments.
* **Capture measurements**: store quantities, durations, distances, or any measurable attribute from source documents.
* **Compute derived values**: calculate totals, averages, ratios, or deltas using Python across multiple columns.

## Setting Up a Number Column

### Step 1: Create the column

* Add a new column to your Phacet.
* Choose **Number** as the column type.
* Give it a clear, descriptive name (e.g. `Revenue`, `Unit Price`, `Risk Score`).

### Step 2: Select your tool

Decide how the numeric values will be populated:

* **Manual Input**: enter numbers directly into each cell.
* **AI (LLM)**: AI will analyze input data and extract numeric values automatically.
* **Python Tool**: compute values using custom logic, formulas, or rules.

## Manual vs Automated input

| Method            | Use it when..                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------- |
| **Manual Input**  | You want to enter values yourself. Ideal for small datasets or when human judgement is required.        |
| **AI (LLM Tool)** | You need to extract numbers from unstructured content: documents, emails, or free-text fields.          |
| **Python Tool**   | You have clear computation rules: formulas, conversions, thresholds, or operations on existing columns. |

### Referencing other data

When using the **AI Tool** or **Python Tool**, you can reference data from other columns using the `@` symbol followed by the column name (e.g. `@Invoice Document`, `@Unit Price`).

This allows your tool to use the value from that column as input.

### AI Tool setup

* Write clear instructions describing the numeric value to extract.
* Reference the source column containing the data to analyze (e.g. a File column or a Text column).
* AI will return a numeric value based on its interpretation of the content.

Learn more about the AI tool <Anchor label="in the dedicated article" target="_blank" href="https://docs.phacetlabs.com/docs/ai-tool#/">in the dedicated article</Anchor>

### Python Tool setup

* Your Python `main()` function must return a numeric value (`int` or `float`) or `None` if no value applies.
* Returning a string, list, or any other type will cause a validation error.

Learn more about the Python tool <Anchor label="in the dedicated article" target="_blank" href="https://docs.phacetlabs.com/docs/python-tool#/">in the dedicated article</Anchor>

## Example prompts and scripts

**AI Tool**

**Extract revenue from a financial report (single value)**

```
Extract the total annual revenue in euros from @Financial Report. Return only the numeric value, without currency symbols or units.
```

**Extract a quantity from an invoice**

```
Read @Invoice document and extract total amount including taxes.
```

**Python Tool**

**Compute a margin from two columns**

```python
def main():
    revenue = @Revenue
    cost = @Cost
    if revenue is None or cost is None:
        return None
    return revenue - cost
```

**Apply a percentage**

```python
def main():
    base_price = @Unit Price
    if base_price is None:
        return None
    return round(base_price * 1.20, 2)
```

**Convert text to number**

```python
def main():
    raw = @Raw Value
    if raw is None:
        return None
    cleaned = raw.replace(" ", "").replace(",", ".")
    return float(cleaned)
```

## Number vs Text for numeric data

You may be tempted to store numeric values in a Text column. Here's why Number columns are a better fit:

| Aspect               | Number Column                           | Text Column                                    |
| -------------------- | --------------------------------------- | ---------------------------------------------- |
| **Validation**       | Only accepts valid numbers or empty     | Accepts any string, including non-numeric      |
| **Computation**      | Ready for math operations in Python     | Requires parsing and conversion first          |
| **Data consistency** | Enforced numeric format across all rows | Risk of mixed formats (e.g. "1,000" vs "1000") |
| **Export**           | Clean numeric values                    | May need post-processing                       |

## Best practices

* **Use descriptive column names**: Include the unit or context when relevant (e.g. `Revenue (EUR)`, `Weight (kg)`).
* **Handle missing values gracefully**: Always account for `None` in your Python functions to avoid runtime errors.
* **Keep precision in mind**: Use `round()` in Python when dealing with decimals to avoid floating-point artifacts.
* **Validate at the source**: If extracting numbers with AI, include explicit instructions about format expectations (no currency symbols, no thousand separators) to get clean results.
* **Combine with other column types**: Use Number columns alongside Text or Select columns to build complete data processing pipelines: extract with AI, compute with Python, classify with Select.

<br />