Click or drag to resize

DataFrame Class

Class DataFrame represents a two-dimensional data object consisting of a list of columns of the same length.
Inheritance Hierarchy

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
[SerializableAttribute]
public class DataFrame : ICloneable

The DataFrame type exposes the following members.

Constructors
 NameDescription
Public methodDataFrame Default constructor. Constructs an empty data frame.
Public methodDataFrame(DataTable) Constructs a DataFrame instance from the given DataTable.
Public methodDataFrame(DFColumn) Constructs a DataFrame instance from the given array of columns.
Public methodDataFrame(String) Constructs a DataFrame instance from the given string.
Public methodDataFrame(DataTable, Int32) Constructs a DataFrame instance from the given DataTable. Row keys are set to the values in the specified column.
Public methodDataFrame(DataTable, Object) Constructs a DataFrame instance from the given DataTable. Row keys are set to the given array of objects.
Public methodDataFrame(DataTable, String) Constructs a DataFrame instance from the given DataTable. Row keys are set to the values in the specified column.
Public methodDataFrame(DFColumn, ICollection) Constructs a DataFrame instance from the given array of columns and a collection of row keys.
Public methodDataFrame(DoubleMatrix, String) Constructs a DataFrame instance from the given matrix.
Public methodDataFrame(String, Boolean, Boolean, String, Boolean) Constructs a DataFrame instance from the given string.
Top
Properties
 NameDescription
Public propertyCols Gets the number of columns in this data frame.
Public propertyColumnHeaders Gets and sets the array of column labels in this data frame.
Public propertyColumnNames Gets an array of the column names in this data frame.
Public propertyCreateDate Gets the creation datetime for this data object.
Public propertyItemInt32 Gets the column indicated by the given column index.
Public propertyItemString Gets the column indicated by the given column name.
Public propertyItemInt32, Slice Gets the subcolumn indicated by the given column index and row slice.
Public propertyItemInt32, Subset Gets the subcolumn indicated by the given column index and row subset.
Public propertyItemInt32, Int32 Gets and sets the element at the given row and column index.
Public propertyItemObject, String Gets and sets the element specified by the given row key and column name.
Public propertyItemSlice, Slice Gets a new data frame containing the portion of this data frame indicated by the given row slice and column slice.
Public propertyItemSlice, Subset Gets a new data frame containing the portion of this data frame indicated by the given row slice and column subset.
Public propertyItemSubset, Slice Gets a new data frame containing the portion of this data frame indicated by the given row subset and column slice.
Public propertyItemSubset, Subset Gets a new data frame containing the portion of this data frame indicated by the given row subset and column subset.
Public propertyName Gets and sets the name for this data frame.
Public propertyRowKeyHeader Gets and sets the header for the row keys in this data frame.
Public propertyRowKeys Gets an object array of the row keys in this data frame.
Public propertyRows Gets the number of rows in this data frame.
Public propertyStringRowKeys Gets a string array of the row keys in this data frame.
Public propertyType Gets the type of this data object.
Top
Methods
 NameDescription
Public methodAddColumn(DataColumn) Adds the given DataColumn to this data frame.
Public methodAddColumn(IDFColumn) Adds a column to this data frame.
Public methodAddColumn(DataColumn, DataRowCollection) Adds the given DataColumn and accompanying data to this data frame.
Public methodAddColumns(DataColumnCollection) Adds a collection of DataColumns to this data frame.
Public methodAddColumns(DataColumnCollection, DataRowCollection) Adds a collection of DataColumns and accompanying data to this data frame.
Public methodAddColumns(DataFrame, Boolean) Adds all columns from another data frame to this data frame, optionally copying the data in the columns.
Public methodAddRow(DataRow) Adds the data from the given DataRow to this data frame.
Public methodAddRow(ICollection) Adds a row to this data frame using default row key (this.Rows + 1).
Public methodAddRow(Int32, DataRow) Adds the data from the given DataRow using the specified column in the row as the row key.
Public methodAddRow(Object, DoubleVector) Adds a row to this data frame.
Public methodAddRow(Object, ICollection) Adds a row to this data frame.
Public methodAddRow(Object, IDictionary) Adds a row to this data frame from the given dictionary.
Public methodAddRow(Object, DataRow) Adds the data from the given DataRow using the given row key.
Public methodAddRow(Object, Object) Adds a row to this data frame.
Public methodAddRows(DataRowCollection) Adds the data from the given DataRowCollection.
Public methodAddRows(Int32, DataRowCollection) Adds the data from the given DataRow using the specified column as row keys.
Public methodAddRows(Object, DataRowCollection) Adds the data from the given DataRowCollection using the specified row keys.
Public methodCleanAndRemoveCols Removes all columns that contain missing values.
Public methodCleanAndRemoveCols(Int32) Removes columns that contain missing values in the given rows.
Public methodCleanAndRemoveRows Removes rows that contain missing values.
Public methodCleanAndRemoveRows(Int32) Removes rows in this data frame that missing values in the given columns.
Public methodCleanCols Returns a new data frame containing the columns in this data frame that do not contain missing values.
Public methodCleanCols(Int32) Returns a new data frame containing the columns in this data frame that do not contain missing values in the given rows.
Public methodCleanRows Returns a new data frame containing the rows in this data frame that do not contain missing values.
Public methodCleanRows(Int32) Returns a new data frame containing the rows in this data frame that do not contain missing values in the given columns.
Public methodClear Removes all columns and all rows from this data frame.
Public methodClone Returns a deep copy of this data frame.
Public methodContainsColumn Tests whether this data frame contains a column of the given name.
Public methodContainsRow Tests whether this data frame contains a row with the given row key.
Public methodGetColumnDictionary(Int32) Returns a dictionary for values in the given column. The row keys are used as keys in the dictionary.
Public methodGetColumnDictionary(String) Returns a dictionary for values in the given column. The row keys are used as keys in the dictionary.
Public methodGetColumnDictionary(Int32, Int32) Returns a dictionary for values in the given column. The dictionary keys are taken from the specified key column.
Public methodGetColumns(Slice) Gets a new data frame containing the portion of this data frame specified by the given column slice.
Public methodGetColumns(Subset) Gets a new data frame containing the portion of this data frame specified by the given column subset.
Public methodGetFactor(Int32) Creates a factor from the given column.
Public methodGetFactor(String) Creates a factor from the given column.
Public methodGetFactor(Int32, Object) Creates a factor from the given column.
Public methodGetFactor(String, Object) Creates a factor from the given column.
Public methodGetRow(Int32) Gets the data for a given row index.
Public methodGetRow(Object) Gets the data for the first row with a given row key.
Public methodGetRowDictionary(Int32) Gets a row dictionary for the given row index. The dictionary keys are the column names.
Public methodGetRowDictionary(Object) Gets a row dictionary for the given row key. The dictionary keys are the column names.
Public methodGetRows(Slice) Gets a new data frame containing the portion of this data frame specified by the given row slice.
Public methodGetRows(Subset) Gets a new data frame containing the portion of this data frame specified by the given row subset.
Public methodGetSubRow(Int32, Slice) Gets the portion of the row in this data frame indicated by the given row index and column slice.
Public methodGetSubRow(Int32, Subset) Gets the portion of the row in this data frame indicated by the given row index and column subset.
Public methodIndexOf Returns the index of the first row with a given value in a specified column.
Public methodIndexOfColumn Return the index of the first column with a given column name.
Public methodIndexOfKey Returns the index of the first row with a given row key.
Public methodIndexRowKeys Resets the row keys for all rows to rowIndex + 1.
Public methodIndicesOf Returns the indices of all rows with a given value in a specified column.
Public methodIndicesOfColumn Returns an array of column indices for the given column name. Column names need not be unique, so multiple columns may share a single name.
Public methodIndicesOfKey Returns the indices of all rows with a given row key.
Public methodInsertColumn Inserts the given column at the given column index.
Public methodInsertRow(Int32, Object, DoubleVector) Inserts the given row at the given row index.
Public methodInsertRow(Int32, Object, ICollection) Inserts the given row at the given row index.
Public methodInsertRow(Int32, Object, IDictionary) Inserts the given row at the given row index.
Public methodStatic memberLoad(String) Imports a data frame from the given text file.
Public methodStatic memberLoad(Stream, String) Imports a data frame from the given stream.
Public methodStatic memberLoad(StreamReader, String) Imports a data frame from the given stream reader.
Public methodStatic memberLoad(String, Boolean, Boolean, String, Boolean) Imports a data frame from the given text file.
Public methodStatic memberLoad(Stream, String, Boolean, Boolean, String, Boolean) Imports a data frame from the given stream.
Public methodStatic memberLoad(StreamReader, String, Boolean, Boolean, String, Boolean) Imports a data frame from the given stream reader.
Public methodOpenInEditor Opens the contents of this data frame in the default text editor.
Public methodPermuteColumns Reorders the columns in this data frame according to the given permutation array.
Public methodPermuteRows Reorders the rows in this data frame according to the given permutation array.
Public methodRemoveAllColumns Removes all columns from this data frame, but preserves the existing row keys.
Public methodRemoveAllRows Removes all rows from this data frame.
Public methodRemoveColumn(Int32) Removes the column from this data frame with the given column index.
Public methodRemoveColumn(String) Removes all columns from this data frame with the given column name.
Public methodRemoveColumns(Slice) Removes the columns from this data frame specified by the given column slice.
Public methodRemoveColumns(Subset) Removes the columns from this data frame specified by the given column subset.
Public methodRemoveRow(Int32) Removes the row from this data table at the given row index.
Public methodRemoveRow(Object) Removes all rows from this data table with the given row key.
Public methodRemoveRows(Slice) Removes the rows from this data frame specified by the given row slice.
Public methodRemoveRows(Subset) Removes the rows from this data frame specified by the given row subset.
Public methodSave(String) Exports the contents of this data frame to a text file.
Public methodSave(String, Boolean, Boolean, String) Exports the contents of this data frame to a text file.
Public methodSave(String, Boolean, Boolean, String, String, String, String) Exports the contents of this data frame to a text file.
Public methodSetRowKey Sets the row key for the given row index to the given value.
Public methodSetRowKeys Sets the row keys in this data frame to the elements of the given collection.
Public methodSortByColumnHeader Sorts the columns in this data frame by the column headers.
Public methodSortRows(Int32) Sorts the rows in this data frame according to the given ordered array of column indices.
Public methodSortRows(Int32, SortingType) Sorts the rows in this data frame according to the given ordered array of column indices. Sort order is determined by the matching array of sorting types (ascending or descending).
Public methodSortRowsByKeys Sorts the rows in this data frame by their row keys in ascending order.
Public methodSortRowsByKeys(SortingType) Sorts the rows in this data frame by their row keys.
Public methodSwapColumns Swaps the position of the given columns in the data frame.
Public methodSwapRows Swaps the position of the given rows in the data frame.
Public methodTabulate(Int32, Int32, FuncIDFColumn, Boolean) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(Int32, Int32, FuncIDFColumn, DateTime) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(Int32, Int32, FuncIDFColumn, Double) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(Int32, Int32, FuncIDFColumn, Int32) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(Int32, Int32, FuncIDFColumn, Object) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(Int32, Int32, FuncIDFColumn, String) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(String, String, FuncIDFColumn, Boolean) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(String, String, FuncIDFColumn, DateTime) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(String, String, FuncIDFColumn, Double) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(String, String, FuncIDFColumn, Int32) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(String, String, FuncIDFColumn, Object) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(String, String, FuncIDFColumn, String) Tabulates the results of applying the given delegate to the values in the specified data column for each level of the specified factor.
Public methodTabulate(Int32, Int32, Int32, FuncIDFColumn, Boolean) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(Int32, Int32, Int32, FuncIDFColumn, DateTime) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(Int32, Int32, Int32, FuncIDFColumn, Double) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(Int32, Int32, Int32, FuncIDFColumn, Int32) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(Int32, Int32, Int32, FuncIDFColumn, Object) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(Int32, Int32, Int32, FuncIDFColumn, String) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(String, String, String, FuncIDFColumn, Boolean) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(String, String, String, FuncIDFColumn, DateTime) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(String, String, String, FuncIDFColumn, Double) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(String, String, String, FuncIDFColumn, Int32) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(String, String, String, FuncIDFColumn, Object) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodTabulate(String, String, String, FuncIDFColumn, String) Tabulates the results of applying the given delegate to the values in the specified data column for every combination of the two specified factors.
Public methodToDataTable Returns a data table containing all data in this data frame.
Public methodToDoubleMatrix Returns a double matrix containing all numeric data in this data frame.
Public methodToString Returns a formatted string representation of this data frame.
(Overrides ObjectToString)
Public methodToString(Boolean, Boolean, String) Returns a formatted string representation of this data frame.
Public methodToString(Boolean, Boolean, String, String, String, String) Returns a formatted string representation of this data frame.
Top
Fields
 NameDescription
Protected fieldcreationDate_ The creation DateTime of this data object.
Protected fieldname_ The name of this data object.
Protected fieldrowKeyHeader_ Heading for row keys
Public fieldrowKeys_ List of row keys
Top
Remarks
Columns may contain difference types of data: numeric, string, boolean, generic, and so on. Methods are provided for appending, inserting, removing, sorting, and permuting rows and columns.
Columns can be accessed by index or name. Rows can be accessed by index or key. Column names and row keys do not need to be unique.
See Also