---
title: "prefix(upTo:)"
framework: tabulardata
role: symbol
role_heading: Instance Method
path: "tabulardata/dataframe/slice/prefix(upto:)"
---

# prefix(upTo:)

Returns a new slice that contains the initial elements of the original slice up to, but not including, the element at a position.

## Declaration

```swift
func prefix(upTo position: Int) -> DataFrame.Slice
```

## Parameters

- `position`: A valid index to an element in the slice.

## Return Value

Return Value A new slice of the underlying data frame.

## See Also

### Creating a Slice by Selecting Rows

- [prefix(_:)](tabulardata/dataframe/slice/prefix(_:).md)
- [prefix(through:)](tabulardata/dataframe/slice/prefix(through:).md)
- [suffix(_:)](tabulardata/dataframe/slice/suffix(_:).md)
- [suffix(from:)](tabulardata/dataframe/slice/suffix(from:).md)
