FrameView Class

Represents a read-only view of an array of data.

Definition

Namespace: Meta.Numerics.Data
Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 4.2.0+6d77d64445f7d5d91b12e331399c4362ecb25333
C#
public class FrameView
Inheritance
Object    FrameView
Derived

Remarks

This is the central class for viewing data in our data frame system.

The methods of this class allow rows and columns of data to be re-ordered, filtered, manipulated, and analyzed. Most of the methods produce a new FrameView that presents a new view of the underlying data, without incurring the time and space costs of copying the underlying stored data.

The simplest data manipulations supported by views include filtering columns using Select and Discard and filtering rows using Where and WhereNotNull.

More advanced manipulations include the addition of computed columns using AddComputedColumnT(String, FuncFrameRow, T) and the computation of aggregate values of groups using GroupBy.

After you have created the view of your data that you want to analyze, the easiest way to hand individual columns of data to column-oriented analysis APIs (like those in the Meta.Numerics.Statistics namespace) is to use the ItemString accessor to get a column, together with the AsT caster to expose it as a collection of the required type. For example, to obtain a estimate of the mean of the population from the sample in the column named "heights", write view["height"].As<double>().PopulationMean(). Note that, for this to succeed, the underlying storage type of the heights column need not be double. As long as the data are convertible to the target type, no problems will arise. For example, the underlying storage type might be int, or double? as long as no null values are present in the view.

To create the original array of data that will be manipulated, use the FrameTable class. Note that, because the underlying data is not copied when a new view is generated, changes to the original table may have unexpected consequences for the views linked to it. Best practice is not to change the underlying data after generating views based on it.

You can export a view to CSV or JSON formats using the ToCsv(TextWriter) and ToDictionaries methods.

Properties

Columns Gets the columns of the table.
ItemString Get the column with the given name.
ItemInt32, Int32 Gets the value in the given cell.
Rows Gets the rows of the table.

Methods

AddComputedColumnT Add a computed column.
AsColumnsT Exposes a list of columns of uniform type.
Discard Constructs a new view that does not contain the given columns.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetColumnIndex Gets the index of a given column.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GroupBy(String, FuncFrameView, IReadOnlyDictionaryString, Object) Groups the data by the values in the given column, and computes aggregate quantities for each group.
GroupByT(String, FuncFrameView, T, String) Groups the data by the values in the given column, and computes the given aggregate quantity for each group.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OrderBy(ComparisonFrameRow) Sorts all rows by the given function.
OrderBy(String) Sorts the rows by the values in the given column.
OrderBy(String, SortOrder) Sort the rows by the values in the given column in the given direction.
OrderByT(String, ComparisonT) Sorts all rows by the given function of the given column.
Select(ICollectionString) Constructs a new view, containing only the given columns.
Select(String) Constructs a new view, containing only the given columns.
ToCsv Write the data in the view to a comma-separated-value file.
ToDictionaries Writes the data in the view as a sequence of dictionaries.
ToStringReturns a string that represents the current object.
(Inherited from Object)
Where(FuncFrameRow, Boolean) Selects rows matching the given criteria.
WhereT(String, FuncT, Boolean) Selects rows in which the value of the given column matches the given criteria.
WhereNotNull Removes any rows that have null values in the named columns.

See Also