One Logo Pool Ball
TabularData · IOS API REFERENCE

DataFrameProtocol

protocol · iOS 15.0+ · SDK 27.1

protocol DataFrameProtocol

A type that represents a data frame.

Members (18)

method · iOS 15.0+

description

Swift declaration
func description(options: FormattingOptions) -> String

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.

method · iOS 15.0+

randomSplit

Swift declaration
func randomSplit(by proportion: Double, seed: Int? = nil) -> (DataFrame.Slice, DataFrame.Slice)

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.

method · iOS 15.0+

stratifiedSplit

Swift declaration
func stratifiedSplit(on columnName: String, by proportion: Double, randomSeed: Int? = nil) -> (DataFrame, DataFrame)

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.

method · iOS 15.0+

stratifiedSplit

Swift declaration
func stratifiedSplit<T0, T1>(on columnID0: ColumnID<T0>, _ columnID1: ColumnID<T1>, by proportion: Double, randomSeed: Int? = nil) -> (DataFrame, DataFrame) where T0 : Hashable, T1 : Hashable

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.

method · iOS 15.0+

stratifiedSplit

Swift declaration
func stratifiedSplit<T0, T1, T2>(on columnID0: ColumnID<T0>, _ columnID1: ColumnID<T1>, _ columnID2: ColumnID<T2>, by proportion: Double, randomSeed: Int? = nil) -> (DataFrame, DataFrame) where T0 : Hashable, T1 : Hashable, T2 : Hashable

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.

method · iOS 15.0+

sorted

Swift declaration
func sorted<T>(on columnID: ColumnID<T>, by areInIncreasingOrder: (T, T) throws -> Bool) rethrows -> 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 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.

method · iOS 15.0+

grouped

Swift declaration
func grouped(by columnID: ColumnID<Date>, timeUnit: Calendar.Component) -> RowGrouping<Int>

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.

method · iOS 15.0+

grouped

Swift declaration
func grouped(by columnName: String, timeUnit: Calendar.Component) -> RowGrouping<Int>

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.

method · iOS 15.0+

writeCSV

Swift declaration
func writeCSV(to url: URL, options: CSVWritingOptions = .init()) throws

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.

method · iOS 16.0+

writeJSON

Swift declaration
func writeJSON(to url: URL, options: JSONWritingOptions = .init()) throws

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)

DataFrameProtocol.stratifiedSplit(on:by:randomSeed:)

A variable number of Swift arguments is not supported.

DataFrameProtocol.sorted(on:_:order:)

Passing a Swift type itself is not supported.

DataFrameProtocol.sorted(on:order:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

DataFrameProtocol.sorted(on:_:order:)

This declaration needs Swift generic type arguments. (no canonical witness for T0)

DataFrameProtocol.sorted(on:_:_:order:)

This declaration needs Swift generic type arguments. (no canonical witness for T0)

DataFrameProtocol.sorted(on:_:by:)

Passing a Swift type itself is not supported.

DataFrameProtocol.grouped(by:transform:)

callback cannot propagate synchronous failure

DataFrameProtocol.grouped(by:transform:)

callback cannot propagate synchronous failure

DataFrameProtocol.grouped(by:)

A variable number of Swift arguments is not supported.

DataFrameProtocol.grouped(by:)

A variable number of Swift arguments is not supported.

DataFrameProtocol.grouped(by:_:)

The iOS SDK compiler rejected this binding: 'some' types are only permitted in properties, subscripts, and functions

DataFrameProtocol.grouped(by:_:_:)

The iOS SDK compiler rejected this binding: 'some' types are only permitted in properties, subscripts, and functions

DataFrameProtocol.joined(_:on:kind:)

The iOS SDK compiler rejected this binding: instance method 'joined(_:on:kind:)' requires that 'R' conform to 'DataFrameProtocol'

DataFrameProtocol.joined(_:on:kind:)

The iOS SDK compiler rejected this binding: instance method 'joined(_:on:kind:)' requires that 'R' conform to 'DataFrameProtocol'

DataFrameProtocol.joined(_:on:kind:)

The iOS SDK compiler rejected this binding: instance method 'joined(_:on:kind:)' requires that 'R' conform to 'DataFrameProtocol'

DataFrameProtocol.joined(_:on:kind:)

The iOS SDK compiler rejected this binding: instance method 'joined(_:on:kind:)' requires that 'R' conform to 'DataFrameProtocol'

All TabularData types →