> For the complete documentation index, see [llms.txt](https://docs.quadratichq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quadratichq.com/python/manipulate-data.md).

# Manipulate data

Perform novel analysis on your data.

Manipulating data in Quadratic is easier than ever as you can view your changes in the sheet in real-time. Here is a non-exhaustive list of ways to manipulate your data in Quadratic:&#x20;

1. [Find correlations ](#1.-find-correlations)
2. [Basic stats - max, min, average, selections, etc.](#2.-basic-stats-max-min-average-selections-etc.)
3. [DataFrame math ](#3.-dataframe-math)
4. [Data selections ](#4.-data-selections)

## 1. Find correlations

```python
# Get the correlation and show the value in the sheet
data['col1'].corr(data['col2'], method='pearson')

# possible methods: pearson, kendall, spearman 
```

## 2. Basic stats - max, min, mean, selections, etc.

Reference: <https://pandas.pydata.org/docs/getting_started/intro_tutorials/06_calculate_statistics.html>

```python
# Get the max value of a column
df["col1"].max()
```

```python
# Get the min value of a column
df["col1"].min()
```

```python
# Get the mean value of a column
df["col1"].mean()
```

```python
# Get the median value of a column
df["col1"].median()
```

```python
# Get the skew for all columns
df.skew()
```

```python
# Count the values in a column
df["col1"].value_counts()
```

```python
# Get the summary of a column
df["col1"].describe()
```

## 3. DataFrame math

Do math on data in the DataFrame. Alternatively, use formulas in the sheet on the values.&#x20;

```python
# Add, subtract, multiply, divide, etc., will all work on all values in a column
df['col1'] + 1
df['col1'] - 1
df['col1'] * 2
df['col1'] / 2 
```

```python
# Do any arbitrary math column-wise with the above or do DataFrame-wise via
df + 1 
```

## 4. Data selections

Alternatively, cut/copy/paste specific values in the sheet.&#x20;

```python
# get a column 
df['col1'] 
```

```python
# get multiple columns 
df[['col1', 'col2']] 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.quadratichq.com/python/manipulate-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
