Click or drag to resize

FrameView Class

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

Namespace:  Meta.Numerics.Data
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: (
public class FrameView

The FrameView type exposes the following members.

Public methodAddComputedColumnT
Add a computed column.
Public methodAsColumnsT
Exposes a list of columns of uniform type.
Public methodDiscard
Constructs a new view that does not contain the given columns.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
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 methodGetColumnIndex
Gets the index of a given column.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGroupBy(String, FuncFrameView, IReadOnlyDictionaryString, Object)
Groups the data by the values in the given column, and computes aggregate quantities for each group.
Public methodGroupByT(String, FuncFrameView, T, String)
Groups the data by the values in the given column, and computes the given aggregate quantity for each group.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOrderBy(String)
Sorts the rows by the values in the given column.
Public methodOrderBy(ComparisonFrameRow)
Sorts all rows by the given function.
Public methodOrderBy(String, SortOrder)
Sort the rows by the values in the given column in the given direction.
Public methodOrderByT(String, ComparisonT)
Sorts all rows by the given function of the given column.
Public methodSelect(ICollectionString)
Constructs a new view, containing only the given columns.
Public methodSelect(String)
Constructs a new view, containing only the given columns.
Public methodToCsv
Write the data in the view to a comma-separated-value file.
Public methodToDictionaries
Writes the data in the view as a sequence of dictionaries.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWhere(FuncFrameRow, Boolean)
Selects rows matching the given criteria.
Public methodWhereT(String, FuncT, Boolean)
Selects rows in which the value of the given column matches the given criteria.
Public methodWhereNotNull
Removes any rows that have null values in the named columns.

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.

See Also