<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TabularData",
  "identifier" : "/documentation/TabularData/DataFrameProtocol/stratifiedSplit(on:by:randomSeed:)-714jk",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TabularData"
    ],
    "preciseIdentifier" : "s:11TabularData0B13FrameProtocolPAAE15stratifiedSplit2on2by10randomSeedAA0bC0V_AItAA8ColumnIDVyqd__G_SdSiSgtSHRd__lF"
  },
  "title" : "stratifiedSplit(on:by:randomSeed:)"
}
-->

# stratifiedSplit(on:by:randomSeed:)

Generates two data frames by randomly splitting the rows of a column,
which you select by column identifier,
into strata.

```
func stratifiedSplit<T>(on columnID: ColumnID<T>, by proportion: Double, randomSeed: Int? = nil) -> (DataFrame, DataFrame) where T : Hashable
```

## Parameters

`columnID`

A column identifier.

`proportion`

A proportion in the range `[0.0, 1.0]`.

`randomSeed`

A seed number for a random-number generator.

## Return Value

A tuple of two data frames.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)