Generates a text representation of the data frame type.
`FormattingOptions.maximumLineWidth` needs to be wide enough to print at least the index column, the truncation
column, and one data column (at least two characters, one for initial of the content, and one for "…").
- Parameter options: A set of formatting options that affect the description string,
including the maximum width of a column and the maximum number of rows.
Generates two data frame slices by randomly splitting the rows of the data table.
- Parameters:
- proportion: A proportion in the range `[0.0, 1.0]`.
- seed: A seed number for a random-number generator.
- Returns: A tuple of two data frame slices.
method · iOS 15.0+
stratifiedSplit
Swift declaration
func stratifiedSplit<T>(on columnID: ColumnID<T>, by proportion: Double, randomSeed: Int? = nil) -> (DataFrame, DataFrame) where T : Hashable
Generates two data frames by randomly splitting the rows of a column,
which you select by column identifier,
into strata.
- Parameters:
- columnID: A column identifier.
- proportion: A proportion in the range `[0.0, 1.0]`.
- randomSeed: A seed number for a random-number generator.
- Returns: A tuple of two data frames.
Generates two data frames by randomly splitting the rows of a column,
which you select by its name, into strata.
- Parameters:
- columnName: The name of a column in the data frame type.
- proportion: A proportion in the range `[0.0, 1.0]`.
- randomSeed: A seed number for a random-number generator.
- Returns: A tuple of two data frames.
Generates two data frames by randomly splitting the rows of two columns, which you select by column identifiers,
into strata.
- Parameters:
- columnID0: A column identifier.
- columnID1: Another column identifier.
- proportion: A proportion in the range `[0.0, 1.0]`.
- randomSeed: A seed number for a random-number generator.
- Returns: A tuple of two data frames.
Generates two data frames by randomly splitting the rows of three columns,
which you select by column identifiers, into strata.
- Parameters:
- columnID0: A column identifier.
- columnID1: A second column identifier.
- columnID2: A third column identifier.
- proportion: A proportion in the range `[0.0, 1.0]`.
- randomSeed: A seed number for a random-number generator.
- Returns: A tuple of two data frames.
method · iOS 15.0+
csvRepresentation
Swift declaration
func csvRepresentation(options: CSVWritingOptions = .init()) throws -> Data
Generates a CSV data instance of the data frame type.
- Parameters:
- options: A ``CSVWritingOptions`` instance.
method · iOS 16.0+
jsonRepresentation
Swift declaration
func jsonRepresentation(options: JSONWritingOptions = .init()) throws -> Data
Generates a JSON data instance of the data frame.
- Parameters:
- options: A ``JSONWritingOptions`` instance.
Generates a data frame by copying the data frame's rows and then sorting the rows according to a column
that you select by its column identifier, with a predicate.
- Parameters:
- columnID: The identifier of a column.
- areInIncreasingOrder: A closure that returns a Boolean that indicates
whether the two elements are in increasing order.
> Note: Elements with a value of `nil` are less than all non-`nil` values.
method · iOS 15.0+
sorted
Swift declaration
func sorted(on columnName: String, order: Order = .ascending) -> DataFrame
Generates a data frame by copying the data frame's rows and then sorting the rows according to a column
that you select by its name.
- Parameters:
- columnName: The name of a column.
- order: A sorting order.
This is a convenience method that only works for columns of the following types:
- <doc://com.apple.documentation/documentation/Swift/Bool>
- <doc://com.apple.documentation/documentation/Swift/Int>
- <doc://com.apple.documentation/documentation/Swift/Float>
- <doc://com.apple.documentation/documentation/Swift/Double>
- <doc://com.apple.documentation/documentation/Foundation/Date>
> Note: Elements with a value of `nil` are less than all non-`nil` values.
Creates a grouping of rows that the method selects
by choosing unique units of time in a date column you select by column identifier.
- Parameters:
- columnID: A column identifier.
- timeUnit: A component of a calendar date.
- Returns: A collection of groups.
After the method aggregates the groups, it creates a column with the same name as the original column
plus the `timeUnit` name.
Creates a grouping of rows that the method selects
by choosing unique units of time in a date column you select by name.
- Parameters:
- columnName: The name of a column.
- timeUnit: A component of a calendar date.
- Returns: A collection of groups.
After the method aggregates the groups, it creates a column with the same name as the original column
plus the `timeUnit` name.
method · iOS 15.0+
grouped
Swift declaration
func grouped<GroupingKey>(by columnID: ColumnID<GroupingKey>) -> RowGrouping<GroupingKey> where GroupingKey : Hashable
Creates a grouping of rows that the method selects
by choosing unique values in a column.
- Parameter columnID: A column identifier.
- Returns: A collection of groups.
get · iOS 15.0+
isEmpty
Swift declaration
var isEmpty: Bool { get }
A Boolean that indicates whether the data frame type is empty.
Creates a CSV file with the contents of the data frame type.
- Parameters:
- url: A location URL in the file system where the method saves the CSV file.
- options: A ``CSVWritingOptions`` instance.
Creates a JSON file with the contents of the data frame.
- Parameters:
- url: A location URL in the file system where the method saves the JSON file.
- options: A ``JSONWritingOptions`` instance.
subscript · iOS 15.0+
subscript
Swift declaration
subscript(range: Range<Int>) -> DataFrame.Slice { get set }
Accesses a slice of the data frame type with an index range.
- Parameter range: An integer range.
subscript · iOS 15.0+
subscript
Swift declaration
subscript<R>(r: R) -> DataFrame.Slice where R : RangeExpression, R.Bound == Int { get set }
Accesses rows of a data frame type with an index range expression.
- Parameter r: An integer range expression.
Skipped declarations
17 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
DataFrameProtocol.randomSplit(by:using:)
This declaration needs Swift generic type arguments. (no canonical witness for G)