Click or drag to resize
FrameExtensions Class
Contains C# and F# extension methods for the `Frame<'R, 'C>` type. The members are automatically available when you import the `Deedle` namespace. The type contains object-oriented counterparts to most of the functionality from the `Frame` module. ## Data structure manipulation Summary 1 ## Input and output Summary 2 ## Missing values Summary 3 [category:Frame and series operations]
Inheritance Hierarchy
SystemObject
  DeedleFrameExtensions

Namespace:  Deedle
Assembly:  Deedle (in Deedle.dll) Version: 1.2
Syntax
C#
[SerializableAttribute]
public class FrameExtensions

The FrameExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberCountColumnsR, C Obsolete.
Returns the total number of row keys in the specified frame. This returns the total length of the row series, including keys for which there is no value available.
Public methodStatic memberCountRowsR, C Obsolete.
Returns the total number of row keys in the specified frame. This returns the total length of the row series, including keys for which there is no value available.
Public methodStatic memberDiffTRowKey, TColumnKey
Returns a frame with columns containing difference between an original value and a value at the specified offset. For example, calling `Frame.diff 1 s` returns a frame where previous column values is subtracted from the current ones. In pseudo-code, the function behaves as follows: result[k] = series[k] - series[k - offset] Columns that cannot be converted to `float` are left without a change. ## Parameters - `offset` - When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values. - `frame` - The input frame containing at least some `float` columns.
Public methodStatic memberDropSparseColumnsTRowKey, TColumnKey
Creates a new data frame that contains only those columns of the original data frame that are _dense_, meaning that they have a value for each row. The resulting data frame has the same number of rows, but may have fewer columns (or no columns at all). ## Parameters - `frame` - An input data frame that is to be filtered [category:Missing values]
Public methodStatic memberDropSparseRowsTRowKey, TColumnKey
Creates a new data frame that contains only those rows of the original data frame that are _dense_, meaning that they have a value for each column. The resulting data frame has the same number of columns, but may have fewer rows (or no rows at all). ## Parameters - `frame` - An input data frame that is to be filtered [category:Missing values]
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberExpandColumnsR(FrameR, String, IEnumerableString)
Creates a new data frame where the specified columns are expanded based on runtime structure of the objects they store. A column can be expanded if it is `Series<string, T>` or `IDictionary<K, V>` or if it is any .NET object with readable properties. ## Example Given a data frame with a series that contains tuples, you can expand the tuple members and get a frame with columns `S.Item1` and `S.Item2`: let df = frame [ "S" => series [ 1 => (1, "One"); 2 => (2, "Two") ] ] df.ExpandColumns ["S"] ## Parameters - `names` - Names of columns in the original data frame to be expanded - `frame` - Input data frame whose columns will be expanded [category:Data structure manipulation]
Public methodStatic memberExpandColumnsR(FrameR, String, Int32, Boolean)
Creates a new data frame where all columns are expanded based on runtime structure of the objects they store. The expansion is performed recrusively to the specified depth. A column can be expanded if it is `Series<string, T>` or `IDictionary<K, V>` or if it is any .NET object with readable properties. ## Parameters - `nesting` - The nesting level for expansion. When set to 0, nothing is done. [category:Data structure manipulation]
Public methodStatic memberFillMissingTRowKey, TColumnKey(FrameTRowKey, TColumnKey, Direction)
Fill missing values in the data frame with the nearest available value (using the specified direction). Note that the frame may still contain missing values after call to this function (e.g. if the first value is not available and we attempt to fill series with previous values). This operation can only be used on ordered frames. ## Parameters - `frame` - An input data frame that is to be filled - `direction` - Specifies the direction used when searching for the nearest available value. `Backward` means that we want to look for the first value with a smaller key while `Forward` searches for the nearest greater key. [category:Missing values]
Public methodStatic memberFillMissingTRowKey, TColumnKey, T(FrameTRowKey, TColumnKey, FuncSeriesTRowKey, T, TRowKey, T)
Fill missing values in the frame using the specified function. The specified function is called with all series and keys for which the frame does not contain value and the result of the call is used in place of the missing value. The operation is only applied to columns (series) that contain values of the same type as the return type of the provided filling function. The operation does not attempt to convert between numeric values (so a series containing `float` will not be converted to a series of `int`). ## Parameters - `frame` - An input data frame that is to be filled - `f` - A function that takes a series `Series<R, T>` together with a key `K` in the series and generates a value to be used in a place where the original series contains a missing value. [category:Missing values]
Public methodStatic memberFillMissingTRowKey, TColumnKey, T(FrameTRowKey, TColumnKey, T)
Fill missing values of a given type in the frame with a constant value. The operation is only applied to columns (series) that contain values of the same type as the provided filling value. The operation does not attempt to convert between numeric values (so a series containing `float` will not be converted to a series of `int`). ## Parameters - `frame` - An input data frame that is to be filled - `value` - A constant value that is used to fill all missing values [category:Missing values]
Public methodStatic memberFilterRowsByTRowKey, TColumnKey, V
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberGetRowsTRowKey, TColumnKey
[category:Fancy accessors]
Public methodStatic memberGetRowsAtTRowKey, TColumnKey
Public methodStatic memberGetSliceTRowKey, TColKey1, TColKey2(ColumnSeriesTRowKey, TupleTColKey1, TColKey2, FSharpOptionTColKey1, FSharpOptionTColKey1, TColKey2)
Public methodStatic memberGetSliceTRowKey, TColKey1, TColKey2(ColumnSeriesTRowKey, TupleTColKey1, TColKey2, TColKey1, FSharpOptionTColKey2, FSharpOptionTColKey2)
Public methodStatic memberGetSliceTRowKey1, TRowKey2, TColKey(RowSeriesTupleTRowKey1, TRowKey2, TColKey, FSharpOptionTRowKey1, FSharpOptionTRowKey1, TRowKey2)
Public methodStatic memberGetSliceTRowKey1, TRowKey2, TColKey(RowSeriesTupleTRowKey1, TRowKey2, TColKey, TRowKey1, FSharpOptionTRowKey2, FSharpOptionTRowKey2)
Public methodStatic memberGetSliceTRowKey, TColKey1, TColKey2(ColumnSeriesTRowKey, TupleTColKey1, TColKey2, FSharpOptionTColKey1, FSharpOptionTColKey1, FSharpOptionTColKey2, FSharpOptionTColKey2)
Public methodStatic memberGetSliceTRowKey1, TRowKey2, TColKey(RowSeriesTupleTRowKey1, TRowKey2, TColKey, FSharpOptionTRowKey1, FSharpOptionTRowKey1, FSharpOptionTRowKey2, FSharpOptionTRowKey2)
Public methodStatic memberGetSliceTRowKey, TColKey1, TColKey2, K1, K2(ColumnSeriesTRowKey, TupleTColKey1, TColKey2, FSharpOptionK1, FSharpOptionK1, FSharpOptionK2, FSharpOptionK2)
Public methodStatic memberGetSliceTRowKey1, TRowKey2, TColKey, K1, K2(RowSeriesTupleTRowKey1, TRowKey2, TColKey, FSharpOptionK1, FSharpOptionK1, FSharpOptionK2, FSharpOptionK2)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberIndexColumnsWithR, C, TNewRowIndex
Replace the column index of the frame with the provided sequence of column keys. The columns of the frame are assigned keys according to the current order, or in a non-deterministic way, if the current column index is not ordered. ## Parameters - `frame` - Source data frame whose column index are to be replaced. - `keys` - A collection of new column keys. [category:Data structure manipulation]
Public methodStatic memberIndexRowsOrdinallyTRowKey, TColumnKey
Replace the row index of the frame with ordinarilly generated integers starting from zero. The rows of the frame are assigned index according to the current order, or in a non-deterministic way, if the current row index is not ordered. ## Parameters - `frame` - Source data frame whose row index are to be replaced. [category:Data structure manipulation]
Public methodStatic memberIndexRowsUsingR, C, R2
Replace the row index of the frame with a sequence of row keys generated using a function invoked on each row. ## Parameters - `frame` - Source data frame whose row index are to be replaced. - `f` - A function from row (as object series) to new row key value [category:Data structure manipulation]
Public methodStatic memberIndexRowsWithR, C, TNewRowIndex
Replace the row index of the frame with the provided sequence of row keys. The rows of the frame are assigned keys according to the current order, or in a non-deterministic way, if the current row index is not ordered. ## Parameters - `frame` - Source data frame whose row index are to be replaced. - `keys` - A collection of new row keys. [category:Data structure manipulation]
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberMergeTRowKey, TColumnKey
Public methodStatic memberNestTRowKey1, TRowKey2, TColumnKey
Given a data frame whose row index has two levels, create a series whose keys are the unique first level keys, and whose values are those corresponding frames selected from the original data. [category:Data structure manipulation]
Public methodStatic memberNestByTRowKey1, TColumnKey, TRowKey2
Given a data frame whose row index has two levels, create a series whose keys are the unique results of the keyselector projection, and whose values are those corresponding frames selected from the original data. [category:Data structure manipulation]
Public methodStatic memberOrderColumnsTRowKey, TColumnKey Obsolete.
[omit]
Public methodStatic memberOrderRowsTRowKey, TColumnKey Obsolete.
[omit]
Public methodStatic memberPivotTableR, C, RNew, CNew, T
Creates a new data frame resulting from a 'pivot' operation. Consider a denormalized data frame representing a table: column labels are field names & table values are observations of those fields. pivotTable buckets the rows along two axes, according to the values of the columns `r` and `c`; and then computes a value for the frame of rows that land in each bucket. ## Parameters - `r` - A column key to group on for the resulting row index - `c` - A column key to group on for the resulting col index - `op` - A function computing a value from the corresponding bucket frame [category:Frame operations]
Public methodStatic memberPrintK, V(FrameK, V)
Public methodStatic memberPrintK, V(FrameK, V, Boolean)
Public methodStatic memberRealignRowsR, C
Align the existing data to a specified collection of row keys. Values in the data frame that do not match any new key are dropped, new keys (that were not in the original data frame) are assigned missing values. ## Parameters - `frame` - Source data frame that is to be realigned. - `keys` - A sequence of new row keys. The keys must have the same type as the original frame keys (because the rows are realigned). [category:Data structure manipulation]
Public methodStatic memberReduceTRowKey, TColumnKey, T
Public methodStatic memberSaveCsvR, C(FrameR, C, String, IEnumerableString, Char, CultureInfo)
Save data frame to a CSV file or to a `Stream`. When calling the operation, you can specify whether you want to save the row keys or not (and headers for the keys) and you can also specify the separator (use `\t` for writing TSV files). When specifying file name ending with `.tsv`, the `\t` separator is used automatically. ## Parameters - `path` - Specifies the output file name where the CSV data should be written - `keyNames` - Specifies the CSV headers for row key (or keys, for multi-level index) - `separator` - Specify the column separator in the file (the default is `\t` for TSV files and `,` for CSV files) - `culture` - Specify the `CultureInfo` object used for formatting numerical data [category:Input and output]
Public methodStatic memberSaveCsvR, C(FrameR, C, Stream, Boolean, IEnumerableString, Char, CultureInfo) Obsolete.
[omit]
Public methodStatic memberSaveCsvR, C(FrameR, C, TextWriter, Boolean, IEnumerableString, Char, CultureInfo)
Save data frame to a CSV file or to a `Stream`. When calling the operation, you can specify whether you want to save the row keys or not (and headers for the keys) and you can also specify the separator (use `\t` for writing TSV files). When specifying file name ending with `.tsv`, the `\t` separator is used automatically. ## Parameters - `writer` - Specifies the text writer to which the CSV data should be written - `includeRowKeys` - When set to `true`, the row key is also written to the output file - `keyNames` - Can be used to specify the CSV headers for row key (or keys, for multi-level index) - `separator` - Specify the column separator in the file (the default is `\t` for TSV files and `,` for CSV files) - `culture` - Specify the `CultureInfo` object used for formatting numerical data [category:Input and output]
Public methodStatic memberSaveCsvR, C(FrameR, C, String, Boolean, IEnumerableString, Char, CultureInfo)
Save data frame to a CSV file or to a `Stream`. When calling the operation, you can specify whether you want to save the row keys or not (and headers for the keys) and you can also specify the separator (use `\t` for writing TSV files). When specifying file name ending with `.tsv`, the `\t` separator is used automatically. ## Parameters - `path` - Specifies the output file name where the CSV data should be written - `includeRowKeys` - When set to `true`, the row key is also written to the output file - `keyNames` - Can be used to specify the CSV headers for row key (or keys, for multi-level index) - `separator` - Specify the column separator in the file (the default is `\t` for TSV files and `,` for CSV files) - `culture` - Specify the `CultureInfo` object used for formatting numerical data [category:Input and output]
Public methodStatic memberSelectTRowKey, TColumnKey, a, b(FrameTRowKey, TColumnKey, FuncKeyValuePairTRowKey, ObjectSeriesTColumnKey, a)
Public methodStatic memberSelectTRowKey, TColumnKey, a, b(FrameTRowKey, TColumnKey, FuncKeyValuePairTRowKey, ObjectSeriesTColumnKey, Int32, a)
Public methodStatic memberSelectColumnKeysTRowKey, TColumnKey, a
Public methodStatic memberSelectRowKeysTRowKey, TColumnKey, a
Public methodStatic memberShiftTRowKey, TColumnKey
Returns a frame with columns shifted by the specified offset. When the offset is positive, the values are shifted forward and first `offset` keys are dropped. When the offset is negative, the values are shifted backwards and the last `offset` keys are dropped. Expressed in pseudo-code: result[k] = series[k - offset] ## Parameters - `offset` - Can be both positive and negative number. - `frame` - The input frame whose columns are to be shifted. ## Remarks If you want to calculate the difference, e.g. `df - (Frame.shift 1 df)`, you can use `Frame.diff` which will be a little bit faster.
Public methodStatic memberSortByColKeyTRowKey, TColumnKey Obsolete.
[omit]
Public methodStatic memberSortByRowKeyTRowKey, TColumnKey Obsolete.
[omit]
Public methodStatic memberSortColumnsByKeyTRowKey, TColumnKey
Returns a data frame that contains the same data as the input, but whose columns are an ordered series. This allows using operations that are only available on indexed series such as alignment and inexact lookup. ## Parameters - `frame` - Source data frame to be ordered. [category:Data structure manipulation]
Public methodStatic memberSortRowsTRowKey, TColumnKey
Returns a data frame that contains the same data as the input, but whose rows are sorted by some column. ## Parameters - `frame` - Source data frame to be ordered. [category:Data structure manipulation]
Public methodStatic memberSortRowsByTRowKey, TColumnKey, V, V2
Returns a data frame that contains the same data as the input, but whose rows are sorted by some column. ## Parameters - `frame` - Source data frame to be ordered. [category:Data structure manipulation]
Public methodStatic memberSortRowsByKeyTRowKey, TColumnKey
Returns a data frame that contains the same data as the input, but whose rows are an ordered series. This allows using operations that are only available on indexed series such as alignment and inexact lookup. ## Parameters - `frame` - Source data frame to be ordered. [category:Data structure manipulation]
Public methodStatic memberSortRowsWithTRowKey, TColumnKey, V
Returns a data frame that contains the same data as the input, but whose rows are sorted by some column. ## Parameters - `frame` - Source data frame to be ordered. [category:Data structure manipulation]
Public methodStatic memberSumR, C
Public methodStatic memberToDataTableR, C
Returns the data of the frame as a .NET `DataTable` object. The column keys are automatically converted to strings that are used as column names. The row index is turned into an additional column with the specified name (the function takes the name as a sequence to support hierarchical keys, but typically you can write just `frame.ToDataTable(["KeyName"])`. ## Parameters - `rowKeyNames` - Specifies the names of the row key components (or just a single row key name if the row index is not hierarchical). [category:Input and output]
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodStatic memberTransposeTRowKey, TColumnKey
Returns a transposed data frame. The rows of the original data frame are used as the columns of the new one (and vice versa). Use this operation if you have a data frame and you mostly need to access its rows as a series (because accessing columns as a series is more efficient). ## Parameters - `frame` - Source data frame to be transposed. [category:Data structure manipulation]
Public methodStatic memberUnnestTRowKey1, TRowKey2, TColumnKey
Given a series whose values are frames, create a frame resulting from the concatenation of all the frames' rows, with the resulting keys having two levels. This is the inverse operation to nest. [category:Data structure manipulation]
Public methodStatic memberWhereTRowKey, TColumnKey(FrameTRowKey, TColumnKey, FuncKeyValuePairTRowKey, ObjectSeriesTColumnKey, Boolean)
Filters frame rows using the specified condition. Returns a new data frame that contains rows for which the provided function returned false. The function is called with `KeyValuePair` containing the row key as the `Key` and `Value` gives access to the row series. ## Parameters * `frame` - A data frame to invoke the filtering function on. * `condition` - A delegate that specifies the filtering condition.
Public methodStatic memberWhereTRowKey, TColumnKey(FrameTRowKey, TColumnKey, FuncKeyValuePairTRowKey, ObjectSeriesTColumnKey, Int32, Boolean)
Filters frame rows using the specified condtion. Returns a new data frame that contains rows for which the provided function returned false. The function is called with `KeyValuePair` containing the row key as the `Key` and `Value` gives access to the row series and a row index. ## Parameters * `frame` - A data frame to invoke the filtering function on. * `condition` - A delegate that specifies the filtering condition.
Public methodStatic memberWindowR, C(FrameR, C, Int32)
Public methodStatic memberWindowR, C, a(FrameR, C, Int32, FuncFrameR, C, a)
Top
See Also