# Slicing & Indexing

## Slicing Notation

Our slice notation is a way of selecting subsets of a specified dataset using a concise, Pythonic syntax. This notation can be used to select rows and columns based on various criteria.

#### Selecting Rows

To select rows using slice notation, you can use the following syntax:

```
start:end
```

Here, `start` and `end` are the starting and ending indices of the slice, respectively. Note that the slice is inclusive of the starting index and exclusive of the ending index.

For example, to select rows 1 to 3 of a dataset, you can use the following slice:

```
1:4
```

This selects rows 1, 2, and 3 (because the slice is inclusive of the starting index 1 and exclusive of the ending index 4).

You can also use negative indices to select rows from the end of the data. For example, to select the last 3 rows, you can use the following slice:

```
-3:
```

This selects the last 3 rows of the dataset (because the slice starts at index -3 and continues to the end of the dataset).

#### Selecting Columns

To select columns using slice notation, you can use the following syntax:

```
:, start:end
```

Here, `start` and `end` are the starting and ending column labels of the slice, respectively. Note that the slice is inclusive of the starting label and exclusive of the ending label.

For example, to select columns "A" through "C" of your dataset, you can use the following slice:

```
:, "A":"D"
```

This selects columns "A", "B", and "C" (because the slice is inclusive of the starting label "A" and exclusive of the ending label "D").

You can also use negative indices to select columns from the end of the dataset. For example, to select all columns except for the last column of a dataset, you can use the following slice:

```
:, :-1
```

This selects all columns up to, but not including, the last column of the dataset.

#### Selecting Rows and Columns

To select both rows and columns using slice notation, you can combine the row and column slices using the following syntax:

```
start_row:end_row, start_col:end_col
```

For example, to select rows 1 to 3 and columns "A" through "C" of your dataset, you can use the following slice:

```
1:4, "A":"C"
```

This selects rows 1, 2, and 3 and columns "A", "B", and "C" (because the slices are inclusive of the starting indices and exclusive of the ending indices).


---

# 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.autogon.ai/slicing-and-indexing.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.
