Reorders parameters of the MapToColumn and MapiToColumn functions. Updates documentation.
This commit is contained in:
Родитель
d46eccb0db
Коммит
beb817c3c3
|
@ -90,7 +90,7 @@ let ``Table.OfRows fails when property has invalid type``() =
|
|||
[<Test; Category("CI")>]
|
||||
let ``MapToColumn replaces existing column - one column to another existing column``() =
|
||||
let t = Table.OfColumns ([Column.Create("a", [|0;1|]); Column.Create("b", [|0;1|])])
|
||||
let t2 = Table.MapToColumn ["b"] "a" (fun a -> a + 1) t
|
||||
let t2 = Table.MapToColumn "a" ["b"] (fun a -> a + 1) t
|
||||
Assert.AreEqual(2, t2.Count, "number of columns")
|
||||
Assert.AreEqual(["b"; "a"], t2 |> colNames, "names of columns") // new 'a' added to the end
|
||||
Assert.AreEqual([|1;2|], t2.["a"].Rows.AsInt |> toArr, "array of t2.a")
|
||||
|
@ -98,7 +98,7 @@ let ``MapToColumn replaces existing column - one column to another existing colu
|
|||
[<Test; Category("CI")>]
|
||||
let ``MapToColumn replaces existing column - one column to itself``() =
|
||||
let t = Table.OfColumns ([Column.Create("a", [|0;1|]); Column.Create("b", [|0;1|])])
|
||||
let t2 = Table.MapToColumn ["a"] "a" (fun a -> a + 1) t
|
||||
let t2 = Table.MapToColumn "a" ["a"] (fun a -> a + 1) t
|
||||
Assert.AreEqual(2, t2.Count, "number of columns")
|
||||
Assert.AreEqual(["b"; "a"], t2 |> colNames, "names of columns") // new 'a' added to the end
|
||||
Assert.AreEqual([|1;2|], t2.["a"].Rows.AsInt |> toArr, "array of t2.a")
|
||||
|
@ -106,7 +106,7 @@ let ``MapToColumn replaces existing column - one column to itself``() =
|
|||
[<Test; Category("CI")>]
|
||||
let ``MapToColumn replaces existing column - 2 columns``() =
|
||||
let t = Table.OfColumns ([Column.Create("a", [|0;1|]); Column.Create("b", [|0;1|])])
|
||||
let t2 = Table.MapToColumn ["a"; "b"] "a" (fun a b -> a + b + 1) t
|
||||
let t2 = Table.MapToColumn "a" ["a"; "b"] (fun a b -> a + b + 1) t
|
||||
Assert.AreEqual(2, t2.Count, "number of columns")
|
||||
Assert.AreEqual(["b"; "a"], t2 |> colNames, "names of columns") // new 'a' added to the end
|
||||
Assert.AreEqual([|1;3|], t2.["a"].Rows.AsInt |> toArr, "array of t2.a")
|
||||
|
@ -124,14 +124,14 @@ let TableF_MapiToColumn_ManyArgs() =
|
|||
|> Table.Add(Column.Create("g", [|7|]))
|
||||
|> Table.Add(Column.Create("h", [|8|]))
|
||||
|> Table.Add(Column.Create("i", [|9|]))
|
||||
let table2 = table |> Table.MapiToColumn ["a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"] "$" (fun idx a b c d e f g h i -> idx)
|
||||
let table2 = table |> Table.MapiToColumn "$" ["a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"] (fun idx a b c d e f g h i -> idx)
|
||||
let col : int[] = table2.["$"].Rows.AsInt |> toArr
|
||||
Assert.AreEqual([|0|], col, "Array of the column '$' produced by MapiToColumn")
|
||||
|
||||
[<Test; Category("CI")>]
|
||||
let TableF_MapiToColumn_OneArg() =
|
||||
let table:Table = Table.OfColumns ([Column.Create("a", [|1|])])
|
||||
let table2 = table |> Table.MapiToColumn ["a"] "$" (fun idx (a:int) -> idx)
|
||||
let table2 = table |> Table.MapiToColumn "$" ["a"] (fun idx (a:int) -> idx)
|
||||
let col : int[] = table2.["$"].Rows.AsInt |> toArr
|
||||
Assert.AreEqual([|0|], col, "Array of the column '$' produced by MapiToColumn")
|
||||
|
||||
|
@ -139,7 +139,7 @@ let TableF_MapiToColumn_OneArg() =
|
|||
[<Test; Category("CI")>]
|
||||
let TableF_MapiToColumn_ZeroArg() =
|
||||
let table:Table = Table.OfColumns ([Column.Create("a", [|1|])])
|
||||
let table2 = table |> Table.MapiToColumn [] "$" (fun idx -> idx)
|
||||
let table2 = table |> Table.MapiToColumn "$" [] (fun idx -> idx)
|
||||
let col : int[] = table2.["$"].Rows.AsInt |> toArr
|
||||
Assert.AreEqual([|0|], col, "Array of the column '$' produced by MapiToColumn")
|
||||
|
||||
|
@ -156,14 +156,14 @@ let TableF_MapToColumn_ManyArgs() =
|
|||
|> Table.Add(Column.Create("g", [|7|]))
|
||||
|> Table.Add(Column.Create("h", [|8|]))
|
||||
|> Table.Add(Column.Create("i", [|9|]))
|
||||
let table2 = table |> Table.MapToColumn ["a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"] "$" (fun a b c d e f g h i -> true)
|
||||
let table2 = table |> Table.MapToColumn "$" ["a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"] (fun a b c d e f g h i -> true)
|
||||
let col : bool[] = table2.["$"].Rows.AsBoolean |> toArr
|
||||
Assert.AreEqual([|true|], col, "Array of the column '$' produced by MapToColumn")
|
||||
|
||||
[<Test; Category("CI")>]
|
||||
let TableF_MapToColumn_OneArg() =
|
||||
let table:Table = Table.OfColumns ([Column.Create("a", [|1|])])
|
||||
let table2 = table |> Table.MapToColumn ["a"] "$" (fun a -> a > 0)
|
||||
let table2 = table |> Table.MapToColumn "$" ["a"] (fun a -> a > 0)
|
||||
let col : bool[] = table2.["$"].Rows.AsBoolean |> toArr
|
||||
Assert.AreEqual([|true|], col, "Array of the column '$' produced by MapToColumn")
|
||||
|
||||
|
@ -171,7 +171,7 @@ let TableF_MapToColumn_OneArg() =
|
|||
[<Test; Category("CI")>]
|
||||
let TableF_MapToColumn_ZeroArg() =
|
||||
let table:Table = Table.OfColumns ([Column.Create("a", [|1|])])
|
||||
let table2 = table |> Table.MapToColumn [] "$" (fun () -> true)
|
||||
let table2 = table |> Table.MapToColumn "$" [] (fun () -> true)
|
||||
let col : bool[] = table2.["$"].Rows.AsBoolean |> toArr
|
||||
Assert.AreEqual([|true|], col, "Array of the column '$' produced by MapToColumn")
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ If the real sequence length will be different than specified, a runtime exceptio
|
|||
let lazyCx = Column.Create ("x", seq{ for i in 0..99 -> float(i) / 10.0 }, 100)
|
||||
|
||||
(**
|
||||
- Another way to create a lazy column is to use `Column.CreateLazy` which takes a `Lazy` instance producing an immutable array and the number of elements.
|
||||
- Another way to create a lazy column is to use `Column.CreateLazy` which takes a `Lazy` instance producing an immutable array, and the number of elements.
|
||||
Evalutation of the array will be performed when the column values are first time accessed.*)
|
||||
let lazyCx' = Column.CreateLazy ("x", lazy(ImmutableArray.Create<float> [| for i in 0..99 -> float(i) / 10.0 |]), 100)
|
||||
|
||||
|
@ -333,7 +333,7 @@ To load a table from a delimited text file, such as CSV file, or using given `Te
|
|||
`Table.Load` function:
|
||||
*)
|
||||
|
||||
let table = Table.Load("table.csv")
|
||||
let table = Table.Load "table.csv"
|
||||
|
||||
(**
|
||||
`Table.Load` performs columns types inference from text. Note that numeric values are always read as `float`
|
||||
|
@ -350,7 +350,7 @@ let tableSinX : Table<SinX> =
|
|||
|
||||
|
||||
(**The overloaded functions `Load` and `Save` allow to provide custom settings,
|
||||
such as specific delimiter, header, support of null strings, and prefefined columns count and types. *)
|
||||
such as specific delimiter, header, support of null strings, and predefined columns count and types. *)
|
||||
|
||||
(**
|
||||
|
||||
|
@ -372,30 +372,30 @@ by choosing the first column having the given name. Still you can explicitly res
|
|||
has all columns excluding unnecessary.
|
||||
2. If multiple columns with same name are necessary, build a new table that has same columns but with unique names.
|
||||
|
||||
Both approaches do not cause any column data evaluation or copying.
|
||||
None of the approaches causes column data evaluation or copying.
|
||||
|
||||
For example, if `table` has several columns named `"x"` and you need only one with index 0,
|
||||
create a table that contains the only needed column `"x"`:
|
||||
build a table that contains the only needed column `"x"`:
|
||||
*)
|
||||
|
||||
let table2 =
|
||||
Table(
|
||||
table
|
||||
|> Seq.mapi (fun i c -> i, c)
|
||||
|> Seq.choose (fun (i, c) ->
|
||||
match c.Name with
|
||||
| "x" when i <> 0 -> None
|
||||
| _ -> Some c))
|
||||
table
|
||||
|> Seq.mapi (fun i c -> i, c)
|
||||
|> Seq.choose (fun (i, c) ->
|
||||
match c.Name with
|
||||
| "x" when i <> 0 -> None
|
||||
| _ -> Some c)
|
||||
|> Table.OfColumns
|
||||
|
||||
(** Next example renames columns named `"x"` by appending the column index to the name: *)
|
||||
|
||||
let table3 =
|
||||
Table(
|
||||
table
|
||||
|> Seq.mapi (fun i c ->
|
||||
match c.Name with
|
||||
| "x" -> Column.Create (sprintf "x (%d)" i, c.Rows, c.Height)
|
||||
| _ -> c))
|
||||
table
|
||||
|> Seq.mapi (fun i c ->
|
||||
match c.Name with
|
||||
| "x" -> Column.Create (sprintf "x (%d)" i, c.Rows, c.Height)
|
||||
| _ -> c)
|
||||
|> Table.OfColumns
|
||||
|
||||
(**
|
||||
### Mapping Rows
|
||||
|
@ -410,7 +410,7 @@ The signature is: `Map<'a,'b,'c> : columnNames:seq<string> -> map:('a->'b) -> ta
|
|||
The generic function `map:'a->'b` is only partially defined. If `columnNames` contains:
|
||||
|
||||
* 0 columns, then `map:unit->'c`, so `'a = unit`, `'b = 'c`
|
||||
* 1 column, then `map:'a->'c`, where `'a` is the type of the column, so `'b = 'c`
|
||||
* 1 column, then `map:'a->'c`, where `'a` is the type of the column, the function result type is `'b = 'c`
|
||||
* 2 columns, then `map:'a->'d->'c`, where `'a` and `'d` are the types of the columns, so `'b = 'd->'c`
|
||||
* 3 columns, then `map:'a->'d->'e->'c`, where `'a`, `'d` and `'e` are the types of the columns, so `'b = 'd->'e->'c`
|
||||
* n...
|
||||
|
@ -430,40 +430,43 @@ let xsinx : float seq =
|
|||
#### Table.MapToColumn, Table.MapiToColumn
|
||||
|
||||
The function `Table.MapToColumn` builds a new table that contains all columns of the given table and
|
||||
a new column or a replacement of an original table column (if there is an existing column with same name as the target name in the original table);
|
||||
a new column or a replacement of an original table column (if there is an existing column with same name as the target name);
|
||||
elements of the column are the results of applying the given function to each of the rows of the given table columns.
|
||||
`Table.MapiToColumn` also provides an integer index passed to the function which indicates the index of row being transformed.
|
||||
|
||||
The signature is: `MapToColumn : columnNames:seq<string> -> newColumnName:string -> map:('a->'b) -> table:Table -> Table`
|
||||
The signature is: `MapToColumn : newColumnName:string -> columnNames:seq<string> -> map:('a->'b) -> table:Table -> Table`
|
||||
|
||||
The generic function `map:'a->'b` is only partially defined. If `columnNames` contains:
|
||||
|
||||
* 0 columns, then `map:unit->'b`, so the new column type is `'b` and `'a = unit`
|
||||
* 0 columns, then `map:unit->'b`, so `'a = unit` and the new column type is `'b`
|
||||
* 1 column, then `map:'a->'b`, where `'a` is the type of the source column, and `'b` is the new column type
|
||||
* 2 columns, then `map:'a->'d->'c`, where `'a` and `'d` are the types of the source columns, so `'b = 'd->'c`, and `'c` is the new column type
|
||||
* 3 columns, then `map:'a->'d->'e->'c`, where `'a`, `'d` and `'e` are the types of the source columns, so `'b = 'd->'e->'c`, and `'c` is the new column type
|
||||
* n...
|
||||
|
||||
Ultimate result type of the `map` function must be valid column type: either `int`, `float`, `string`, `bool` or `System.DateTime`.
|
||||
Ultimate result type of the `map` function must be valid column type: either `int`, `float`, `string`, `bool` or `DateTime`.
|
||||
|
||||
The following examples adds new table column named `"log(x)"` which contains logarithm of the column `"x"` value for each of the table rows:
|
||||
*)
|
||||
|
||||
let tableLog =
|
||||
table
|
||||
|> Table.MapToColumn ["x"] "log(x)" log
|
||||
let tableLog = table |> Table.MapToColumn "log(x)" ["x"] log
|
||||
|
||||
(*** include-value: tableLog ***)
|
||||
|
||||
(**
|
||||
### Filtering Rows _to do_
|
||||
### Filtering Rows
|
||||
|
||||
The filtering functions return a new table containing all rows from a table where a predicate is true,
|
||||
while the predicate takes a set of columns.
|
||||
The function `Table.Filter` returns a new table containing only the rows of the table for which the given predicate returns `true`.
|
||||
The predicate gets values of the given columns only. `Table.Filteri` also provides an integer index passed to the predicate which indicates the index of row being filtered.
|
||||
|
||||
`Table.Filter`
|
||||
`Table.Filteri`
|
||||
The signature is: `Filter : columnNames:seq<string> -> predicate:('a->'b) -> table:Table -> Table`
|
||||
|
||||
The generic function `predicate:'a->'b` is only partially defined. If `columnNames` contains:
|
||||
|
||||
* 1 column, then `predicate:'a->bool`, where `'a` is the type of the column, and `'b = bool`
|
||||
* 2 columns, then `predicate:'a->'d->bool`, where `'a` and `'d` are the types of the columns, and `'b = 'd->bool`
|
||||
* 3 columns, then `predicate:'a->'d->'e->bool`, where `'a`, `'d` and `'e` are the types of the columns, and `'b = 'd->'e->bool`
|
||||
* n...
|
||||
*)
|
||||
|
||||
(**
|
||||
|
@ -472,21 +475,71 @@ the column `"x"` is between 0 and 1:
|
|||
*)
|
||||
|
||||
let table_filter_x = table |> Table.Filter ["x"] (fun x -> x >= 0.0 && x <= 1.0)
|
||||
|
||||
(*** include-value: table_filter_x ***)
|
||||
|
||||
(**
|
||||
To get a subset of table rows, use the function `Table.Filteri`:
|
||||
*)
|
||||
(** To get a subset of table rows, use the function `Table.Filteri`. The following example builds a table that contains only first 10 rows of the original table: *)
|
||||
|
||||
let table_10rows = table |> Table.Filteri [] (fun i -> i < 10)
|
||||
|
||||
(**
|
||||
### Transforming and Appending Tables _to do_
|
||||
### Concatenating Tables
|
||||
|
||||
`Table.Append`
|
||||
`Table.Transform`
|
||||
`Table.AppendTransform` *)
|
||||
The function `Table.Append` returns a new table that contains the columns of both given tables in order.
|
||||
Duplicate column names are allowed. Heights of the tables must be equal.
|
||||
|
||||
The signature is: `Table.Append : table1:Table -> table2:Table -> Table`
|
||||
|
||||
### Transforming Tables
|
||||
|
||||
The function `Table.Transform` applies the given function to the values of the given table columns and returns the function result.
|
||||
Each column is represented as an immutable array.
|
||||
|
||||
The signature is: `Transform<'a,'b,'c> : columnNames:seq<string> -> transform:(ImmutableArray<'a>->'b) -> table:Table -> 'c`
|
||||
|
||||
The generic function `transform:ImmutableArray<'a>->'b` is only partially defined. If `columnNames` contains:
|
||||
|
||||
* 1 column, then `transform:ImmutableArray<'a>->'c`, where `'a` is the type of the column, so `'b = 'c`.
|
||||
* 2 columns, then `transform:ImmutableArray<'a>->ImmutableArray<'d>->'c`, where `'a` and `'d` are the types of the columns, so `'b = ImmutableArray<'d>->'c`
|
||||
* n...
|
||||
|
||||
The following example computes the midpoint approximation to the integral of `sin(x)` using the table containing columns "x" and "sin(x)":
|
||||
*)
|
||||
|
||||
let integr : float =
|
||||
table
|
||||
|> Table.Transform ["x";"sin(x)"] (fun (x:ImmutableArray<float>) (sinx:ImmutableArray<float>) ->
|
||||
let mutable sum = 0.0
|
||||
for i in 0..x.Length-2 do sum <- sum + sinx.[i] * (x.[i+1] - x.[i])
|
||||
sum)
|
||||
(*** include-value:integr ***)
|
||||
|
||||
(** The next example builds a new table which contains a single column with running maximum of the column "sin(x)" of the existing table: *)
|
||||
|
||||
let getRunningMax(values: ImmutableArray<float>) =
|
||||
values
|
||||
|> Seq.skip 1
|
||||
|> Seq.scan(fun max sin -> if sin > max then sin else max) values.[0]
|
||||
|
||||
let tableMax : Table =
|
||||
table
|
||||
|> Table.Transform ["sin(x)"] (fun (sinx:ImmutableArray<float>) ->
|
||||
Table.OfColumns [ Column.Create("running max of sin(x)", getRunningMax sinx) ])
|
||||
|
||||
(*** include-value:tableMax ***)
|
||||
|
||||
(** There are cases when the table produced by `Transform` should be appended to the original table.
|
||||
The function `Table.AppendTransform` transforms the original table and then concatenates the original and transformed tables: *)
|
||||
|
||||
let tableWithMax : Table =
|
||||
table
|
||||
|> Table.AppendTransform ["sin(x)"] (fun (sinx:ImmutableArray<float>) ->
|
||||
Table.OfColumns [ Column.Create("running max of sin(x)", getRunningMax sinx) ])
|
||||
|
||||
(*** include-value:tableWithMax ***)
|
||||
|
||||
(** The signature is: `AppendTransform : columnNames:seq<string> -> transform:(ImmutableArray<'a>->'b) -> table:Table -> Table`
|
||||
|
||||
It is similar to the `Transform` function but here the ultimate result type of the partially defined function `transform` must be `Table`. *)
|
||||
|
||||
(*** define:typedef-Column ***)
|
||||
type Column =
|
||||
|
|
|
@ -364,37 +364,37 @@ type Table internal (columns : Column list, height : int) =
|
|||
for i = 1 to columns.Length do row.[i] <- colArrays.[i-1].[rowIdx]
|
||||
deleg.DynamicInvoke(row) :?> 'c)
|
||||
|
||||
static member private MapToColumn_a<'a,'b,'c> (columnNames:seq<string>) (newColumnName:string) (map:('a->'b)) (table:Table) : Table =
|
||||
static member private MapToColumn_a<'a,'b,'c> (newColumnName:string) (columnNames:seq<string>) (map:('a->'b)) (table:Table) : Table =
|
||||
let columnArray = Table.Map<'a,'b,'c> columnNames map table |> ImmutableArray.CreateRange
|
||||
if table.Columns |> List.exists (fun c -> c.Name = newColumnName) then table |> Table.Remove [newColumnName] else table
|
||||
|> Table.Add (Column.Create(newColumnName, columnArray))
|
||||
|
||||
static member private reflectedMapToColumn_a = typeof<Table>.GetMethod("MapToColumn_a", Reflection.BindingFlags.Static ||| Reflection.BindingFlags.NonPublic)
|
||||
|
||||
static member MapToColumn(columnNames:seq<string>) (newColumnName:string) (map:('a->'b)) (table:Table) : Table =
|
||||
static member MapToColumn (newColumnName:string) (columnNames:seq<string>) (map:('a->'b)) (table:Table) : Table =
|
||||
let names = columnNames |> Seq.toArray
|
||||
match names.Length with
|
||||
| 0 | 1 -> Table.MapToColumn_a<'a,'b,'b> names newColumnName map table
|
||||
| 0 | 1 -> Table.MapToColumn_a<'a,'b,'b> newColumnName names map table
|
||||
| n ->
|
||||
let res = Funcs.getNthResultType n map
|
||||
let mapTable = Table.reflectedMapToColumn_a.MakeGenericMethod( typeof<'a>, typeof<'b>, res )
|
||||
mapTable.Invoke(null, [|box names; box newColumnName; box map; box table|]) :?> Table
|
||||
mapTable.Invoke(null, [|box newColumnName; box names; box map; box table|]) :?> Table
|
||||
|
||||
static member private MapiToColumn_a<'a,'c> (columnNames:seq<string>) (newColumnName:string) (map:(int->'a)) (table:Table) : Table =
|
||||
static member private MapiToColumn_a<'a,'c> (newColumnName:string) (columnNames:seq<string>) (map:(int->'a)) (table:Table) : Table =
|
||||
let columnArray = Table.Mapi<'a,'c> columnNames map table |> ImmutableArray.CreateRange
|
||||
if table.Columns |> List.exists (fun c -> c.Name = newColumnName) then table |> Table.Remove [newColumnName] else table
|
||||
|> Table.Add (Column.Create(newColumnName, columnArray))
|
||||
|
||||
static member private reflectedMapiToColumn_a = typeof<Table>.GetMethod("MapiToColumn_a", Reflection.BindingFlags.Static ||| Reflection.BindingFlags.NonPublic)
|
||||
|
||||
static member MapiToColumn(columnNames:seq<string>) (newColumnName:string) (map:(int->'a)) (table:Table) : Table =
|
||||
static member MapiToColumn (newColumnName:string) (columnNames:seq<string>) (map:(int->'a)) (table:Table) : Table =
|
||||
let names = columnNames |> Seq.toArray
|
||||
match names.Length with
|
||||
| 0 -> Table.MapiToColumn_a<'a,'a> names newColumnName map table
|
||||
| 0 -> Table.MapiToColumn_a<'a,'a> newColumnName names map table
|
||||
| n ->
|
||||
let res = Funcs.getNthResultType (n+1) map
|
||||
let mapTable = Table.reflectedMapiToColumn_a.MakeGenericMethod( typeof<'a>, res )
|
||||
mapTable.Invoke(null, [|box names; box newColumnName; box map; box table|]) :?> Table
|
||||
mapTable.Invoke(null, [|box newColumnName; box names; box map; box table|]) :?> Table
|
||||
|
||||
static member Transform<'a,'b,'c> (columnNames:seq<string>) (transform:(ImmutableArray<'a>->'b)) (table:Table) : 'c =
|
||||
let cs = Seq.toArray columnNames
|
||||
|
|
|
@ -136,8 +136,9 @@ type [<Class>] Table =
|
|||
/// contained in the given column names.
|
||||
static member Remove : columnNames:seq<string> -> table:Table -> Table
|
||||
|
||||
/// Return a new table containing all rows from a table where a predicate is true, where the predicate takes a set of columns
|
||||
/// The generic predicate function is only partially defined
|
||||
/// The function `Table.Filter` returns a new table containing only the rows of the table for which the given predicate returns `true`.
|
||||
/// The predicate gets values of the given columns only.
|
||||
/// The generic predicate function is only partially defined.
|
||||
/// If there are:
|
||||
/// 1 column, predicate should be predicate:('a->bool), where 'a is the type of the column, so 'b = bool
|
||||
/// 2 columns, predicate:('b>'c->bool), where 'b and 'c are the types of the columns, so 'b = 'c->bool
|
||||
|
@ -145,96 +146,45 @@ type [<Class>] Table =
|
|||
/// n...
|
||||
static member Filter : columnNames:seq<string> -> predicate:('a->'b) -> table:Table -> Table
|
||||
|
||||
/// Return a new table containing all rows from a table where a predicate is true, where the predicate takes a set of columns and row index
|
||||
/// The generic predicate function is only partially defined
|
||||
/// If there are:
|
||||
/// 0 column, predicate should be: `int->bool`, so `'a = bool`
|
||||
/// 1 column, predicate should be: `int->'b->bool`, where 'b is the type of the column, so `'a = 'b -> bool`
|
||||
/// 2 columns, predicate should be: `int->'b->'c->bool`, where 'b and 'c are the types of the columns, so 'a = 'b->'c->bool
|
||||
/// n...
|
||||
/// The function `Table.Filter` returns a new table containing only the rows of the table for which the given predicate returns `true`.
|
||||
/// The predicate gets values of the given columns only. An integer index passed to the predicate is the index of row being filtered.
|
||||
/// The generic predicate function is only partially defined.
|
||||
static member Filteri : columnNames:seq<string> -> predicate:(int->'a) -> table:Table -> Table
|
||||
|
||||
/// Builds a new sequence whose elements are the results of applying the given function 'map'
|
||||
/// to each of the rows of the given table columns.
|
||||
///
|
||||
/// The generic map function is only partially defined.
|
||||
/// If there are:
|
||||
///
|
||||
/// - 0 columns, map should be `map:(unit->'c)`, where `'a` is the type of the column, so `'a = unit` and `'b = 'c`
|
||||
/// - 1 column, map should be `map:('a->'c)`, where `'a` is the type of the column, so `'b = 'c`
|
||||
/// - 2 columns, map('a->'d->'c), where 'a and 'd are the types of the columns, so 'b = 'd->'c
|
||||
/// - 3 columns, map('a->'d->'e->'c), where 'a, 'd and 'e are the types of the columns, so 'b = 'd->'e->'c
|
||||
/// - n...
|
||||
/// to each of the rows of the given table columns. The generic `map` function is only partially defined.
|
||||
static member Map<'a,'b,'c> : columnNames:seq<string> -> map:('a->'b) -> table:Table -> 'c seq
|
||||
|
||||
/// <summary>Builds a new sequence whose elements are the results of applying the given function 'map'
|
||||
/// to each of the rows of the given table columns.
|
||||
/// The integer index passed to the function indicates the index of row being transformed.</summary>
|
||||
/// <remarks><p>The generic map function is only partially defined.
|
||||
/// If there are:
|
||||
/// 0 columns, map is called for each row of the table and should be map:(int->'c), so 'a = 'c
|
||||
/// 1 column, map should be map:(int->'d->'c), where 'd is the type of the column, so 'a = 'd->'c
|
||||
/// 2 columns, map:(int->'d->'e->'c), where 'd and 'e are the types of the columns, so 'a = 'd->'e->'c
|
||||
/// n...
|
||||
/// </p></remarks>
|
||||
/// Builds a new sequence whose elements are the results of applying the given function 'map'
|
||||
/// to each of the rows of the given table columns.
|
||||
/// The integer index passed to the function indicates the index of row being transformed.
|
||||
/// The generic `map` function is only partially defined.
|
||||
static member Mapi<'a,'c> : columnNames:seq<string> -> map:(int->'a) -> table:Table -> 'c seq
|
||||
|
||||
/// Builds a new table that contains all columns of the given table and a new column or a replacement of an original table column;
|
||||
/// elements of the column are the results of applying the given function to each of the rows of the given table columns.
|
||||
///
|
||||
/// The generic map function is only partially defined.
|
||||
/// If there are:
|
||||
///
|
||||
/// - 1 column, map should be map:('a->'c), where 'a is the type of the column, so 'b = 'c
|
||||
/// - 2 columns, map('a->'d->'c), where 'a and 'd are the types of the columns, so 'b = 'd->'c
|
||||
/// - 3 columns, map('a->'d->'e->'c), where 'a, 'd and 'e are the types of the columns, so 'b = 'd->'e->'c
|
||||
/// - n...
|
||||
///
|
||||
/// Ultimate result type of the map function must be either Int, Float, String, Bool or DateTime.
|
||||
/// </remarks>
|
||||
static member MapToColumn : columnNames:seq<string> -> newColumnName:string -> map:('a->'b) -> table:Table -> Table
|
||||
/// The generic `map` function is only partially defined.
|
||||
/// Ultimate result type of the map function must be either `float`, `int`, `string`, `bool` or `DateTime`.
|
||||
static member MapToColumn : newColumnName:string -> columnNames:seq<string> -> map:('a->'b) -> table:Table -> Table
|
||||
|
||||
/// <summary>Builds a new table that contains all columns of the given table and a new column or a replacement of an original table column;
|
||||
/// Builds a new table that contains all columns of the given table and a new column or a replacement of an original table column;
|
||||
/// elements of the column are the results of applying the given function to each of the rows of the given table columns.
|
||||
/// The integer index passed to the function indicates the index of row being transformed.</summary>
|
||||
/// <remarks><p>The generic map function is only partially defined.
|
||||
/// If there are:
|
||||
/// 0 columns, map is called for each row of the table and should be map:(int->'c), so 'a = 'c
|
||||
/// 1 column, map should be map:(int->'d->'c), where 'd is the type of the column, so 'a = 'd->'c
|
||||
/// 2 columns, map:(int->'d->'e->'c), where 'd and 'e are the types of the columns, so 'a = 'd->'e->'c
|
||||
/// n...
|
||||
/// </p>
|
||||
/// <p>Ultimate result type of the map function must be either Int, Float, String, Bool or DateTime.</p>
|
||||
/// </remarks>
|
||||
static member MapiToColumn : columnNames:seq<string> -> newColumnName:string -> map:(int->'a) -> table:Table -> Table
|
||||
/// The integer index passed to the function indicates the index of row being transformed.
|
||||
/// The generic `map` function is only partially defined.
|
||||
/// Ultimate result type of the map function must be either `float`, `int`, `string`, `bool` or `DateTime`.
|
||||
static member MapiToColumn : newColumnName:string -> columnNames:seq<string> -> map:(int->'a) -> table:Table -> Table
|
||||
|
||||
/// <summary>Applies the given function to the arrays of given table columns.</summary>
|
||||
/// <remarks>
|
||||
/// <p>The generic curried transform function is only partially defined.
|
||||
/// If there are:
|
||||
/// 1 column, transform should be transform:('a->'c) where 'a is an array corresponding to the column type, so 'b = 'c
|
||||
/// 2 columns, transform('a->'d->'c) where 'a, 'd are arrays corresponding to the columns types, so 'b = 'd->'c
|
||||
/// 3 columns, transform('a->'d->'e->'c) where 'a, 'd, 'e are arrays corresponding to the columns types, so 'b = 'd->'e->'c
|
||||
/// n...</p>
|
||||
/// </remarks>
|
||||
/// Applies the given function to the values of the given table columns and returns the function result.
|
||||
/// Each column is represented as an immutable array.
|
||||
/// The generic transform function is only partially defined.
|
||||
static member Transform<'a,'b,'c> : columnNames:seq<string> -> transform:(ImmutableArray<'a>->'b) -> table:Table -> 'c
|
||||
|
||||
/// Builds a new table that contains columns of both given tables. Duplicate column names are allowed.
|
||||
/// Builds a new table that contains the columns of both given tables in order. Duplicate column names are allowed.
|
||||
static member Append : table1:Table -> table2:Table -> Table
|
||||
/// Builds a new matrix table by concatenting columns of two given matrix tables. Duplicate column names are allowed.
|
||||
static member AppendMatrix : table1:MatrixTable<'v> -> table2:MatrixTable<'v> -> MatrixTable<'v>
|
||||
|
||||
/// <summary>Builds a new table that contains columns of the given table appended with columns of a table produced by the
|
||||
/// given function applied to the arrays of given table columns.</summary>
|
||||
/// <remarks>
|
||||
/// <p>The generic curried transform function is only partially defined.
|
||||
/// If there are:
|
||||
/// 1 column, transform should be transform:('a->Table) where 'a is an array corresponding to the column type, so 'b = Table
|
||||
/// 2 columns, transform('a->'d->Table) where 'a, 'd are arrays corresponding to the columns types, so 'b = 'd->Table
|
||||
/// 3 columns, transform('a->'d->'e->Table) where 'a, 'd, 'e are arrays corresponding to the columns types, so 'b = 'd->'e->Table
|
||||
/// n...</p>
|
||||
/// <p>The transform function argument types may be one of: Column, T[], IRArray<T> or Array.</p>
|
||||
/// </remarks>
|
||||
/// Builds a new table that contains columns of the given table appended with columns of a table produced by the
|
||||
/// given function applied to the values of the given table columns.
|
||||
/// The generic transform function is only partially defined but its ultimate result must be of type `Table`.
|
||||
static member AppendTransform : columnNames:seq<string> -> transform:(ImmutableArray<'a>->'b) -> table:Table -> Table
|
||||
|
||||
/// Loads a table from a delimited text file.
|
||||
|
|
Загрузка…
Ссылка в новой задаче