Libraries.Compute.Statistics.DataFrameColumn Documentation

This class represents a column on the system. Columns do not have a type themselves, but all subclasses can be made to have any arbitrary type, even custom ones. Columns by default can accept calculations, which send elements to the calculation of the appropriate type and conduct operations. DataFrame objects use the appropriate subclass of column automatically when reading in data frames from disk, based upon the first item in the spreadsheet. Note that in most cases, a user will not interact directly with this class. It is a parent class that encapsulates some common functionality, but typically one would pass a calculation or other operation to this class. The raw data of a column can also be manipulated directly, but type information must be checked through the appropriate actions (e.g., IsBooleanColumn). This is to balance the need to sometimes iterate through a column with the opposite need to manipulate its data directly.

Example Code

use Libraries.Compute.Statistics.DataFrame
    use Libraries.Compute.Statistics.DataFrameColumn

    //Load a comma separated file
    DataFrame frame
    frame:Load("Data.csv") 
    DataFrameColumn col = frame:GetColumn(0)
    output col:ToText()

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(text value)Columns may optionally add data from a text representation of that data.
Calculate(Libraries.Compute.Statistics.DataFrameColumnCalculation calculation)This action conducts a calculation on this column.
CalculateValueCountAsText()This action returns a HashTable with AsText key values and counts of the items in the column.
CanConvertToVector()This action returns whether or not this column type can be converted to a Vector of numbers.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
ConvertToBooleanColumn()Regardless of the type of this column, the system will attempt to convert it to a BooleanColumn.
ConvertToIntegerColumn()Regardless of the type of this column, the system will attempt to convert it to an IntegerColumn.
ConvertToNumberColumn()Regardless of the type of this column, the system will attempt to convert it to a NumberColumn.
ConvertToTextColumn()Regardless of the type of this column, the system will attempt to convert it to a TextColumn.
ConvertToVector()Some column types can be converted to a raw vector of numbers.
Copy(integer rowStart, integer rowEnd, boolean sort, boolean unique)This action does a deep copy of the row between the 0-indexed rowStart and rowEnd.
Copy()This action conducts a deep copy of the column.
Copy(boolean sort, boolean unique)This action conducts a deep copy of the column.
Copy(integer rowStart, integer rowEnd)This action does a deep copy of the row between the 0-indexed rowStart and rowEnd.
CopyToRow(Libraries.Compute.Statistics.DataFrameColumn column, integer to, integer from)Copy from a row to copy from.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetAsBoolean(integer index)Regardless of the type of the column, this action attempts to convert the item at the index to a boolean.
GetAsInteger(integer index)Regardless of the type of the column, this action attempts to convert the item at the index to an integer.
GetAsNumber(integer index)Regardless of the type of the column, this action attempts to convert the item at the index to a number.
GetAsText(integer index)Regardless of the type of the column, this action attempts to convert the item at the index to text.
GetHashCode()This action gets the hash code for an object.
GetHeader()This gets the header for this column.
GetSize()This action returns the number of rows.
GetUndefinedSize()This action returns the number of items in this column that are undefined.
GetUndefinedText()This action returns a default text string for undefined values.
IsBooleanColumn()This action detects whether this column ultimately stores booleans inside of it.
IsIntegerColumn()This action detects whether this column ultimately stores integers inside of it.
IsNumberColumn()This action detects whether this column ultimately stores numbers inside of it.
IsTextColumn()This action detects whether this column ultimately stores text inside of it.
IsUndefined(integer row)This action detects whether a particular index is an undefined value in the column.
Move(integer left, integer right)This action moves the value in row left to the value in row right.
SendValueTo(integer index, Libraries.Compute.Statistics.DataFrameColumnCalculation calculation)This action sends an individual data point to a calculation, typed appropriately by its subclass.
SetAsBoolean(integer index, boolean value)This action sets the index to a boolean if and only if this is a boolean column.
SetAsInteger(integer index, integer value)This action sets the index to an integer if and only if this is an integer column.
SetAsNumber(integer index, number value)This action sets the index to a number if and only if this is a number column.
SetAsText(integer index, text value)This action sets the index to text if and only if this is a text column.
SetHeader(text header)This sets the header for this column.
SetSize(integer size)This action sets the size of the column to the parameter and then fills it with undefined values.
Swap(integer left, integer right)This action swaps two values in the column.
ToText()This is a convenience action that converts the entire column to a text format.

Actions Documentation

Add(text value)

Columns may optionally add data from a text representation of that data. This can be in any arbitrary format determined by the column implementor. The Add action does the auto-conversion, while the set values are only accepted if that data type is allowed. The broad purpose is to allow this action to read in from an arbitrary text source and add it to the column.

Parameters

Calculate(Libraries.Compute.Statistics.DataFrameColumnCalculation calculation)

This action conducts a calculation on this column. The calculation begins by issuing a Start action. Then if it is an iterable action, sends each data point to the class for processing. If not, it is asked to conduct the entire operation at once on the full data set. Finally, it issues an end action.

Parameters

CalculateValueCountAsText()

This action returns a HashTable with AsText key values and counts of the items in the column.

Return

Libraries.Containers.HashTable: a HashTable with the count for each item in the column.

CanConvertToVector()

This action returns whether or not this column type can be converted to a Vector of numbers.

Return

boolean: true if this column type can be converted and false if it would throw an error on conversion.

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

ConvertToBooleanColumn()

Regardless of the type of this column, the system will attempt to convert it to a BooleanColumn. This may cause an error to be thrown if the types are not compatible. Attrribute: Returns the newly converted column

Return

Libraries.Compute.Statistics.Columns.BooleanColumn:

ConvertToIntegerColumn()

Regardless of the type of this column, the system will attempt to convert it to an IntegerColumn. This may cause an error to be thrown if the types are not compatible. Attrribute: Returns the newly converted column

Return

Libraries.Compute.Statistics.Columns.IntegerColumn:

ConvertToNumberColumn()

Regardless of the type of this column, the system will attempt to convert it to a NumberColumn. This may cause an error to be thrown if the types are not compatible. Attrribute: Returns the newly converted column

Return

Libraries.Compute.Statistics.Columns.NumberColumn:

ConvertToTextColumn()

Regardless of the type of this column, the system will attempt to convert it to a TextColumn. This may cause an error to be thrown if the types are not compatible. Attrribute: Returns the newly converted column

Return

Libraries.Compute.Statistics.Columns.TextColumn:

ConvertToVector()

Some column types can be converted to a raw vector of numbers. All other column types throw an error if they cannot convert. This vector conversion stores numbers more tightly in primitive form, so no undefined values are allowed, but the system can process on the vector more quickly and efficiently.

Return

Libraries.Compute.Vector: the vector

Copy(integer rowStart, integer rowEnd, boolean sort, boolean unique)

This action does a deep copy of the row between the 0-indexed rowStart and rowEnd. The two extra parameters indicate whether to sort the column or whether to require that it be unique.

Parameters

Return

Libraries.Compute.Statistics.DataFrameColumn:

Copy()

This action conducts a deep copy of the column.

Return

Libraries.Compute.Statistics.DataFrameColumn:

Copy(boolean sort, boolean unique)

This action conducts a deep copy of the column. The two parameters indicate whether to sort the column or whether to require that it be unique.

Parameters

Return

Libraries.Compute.Statistics.DataFrameColumn:

Copy(integer rowStart, integer rowEnd)

This action does a deep copy of the row between the 0-indexed rowStart and rowEnd.

Parameters

Return

Libraries.Compute.Statistics.DataFrameColumn:

CopyToRow(Libraries.Compute.Statistics.DataFrameColumn column, integer to, integer from)

Copy from a row to copy from. Specifically, this grabs a value from the 'from' parameter inside the passed column value. It then places this row value into the to position inside of this column. This operation is destructive, meaning that the old value of the to position is destroyed. An error is thrown if the to value is invalid, below 0 or greater than the size. If the columns are not compatible, this throws an error. For example, if we try to set a number to a non-number column, this is an error.

Example Code

use Libraries.Compute.Statistics.DataFrame
        use Libraries.Compute.Statistics.DataFrameColumn
        DataFrame frame
        frame:Load("Data.csv")
        DataFrameColumn col1 = frame:GetColumn(0)
        DataFrameColumn col2 = frame:GetColumn(1)

        //Assuming the types are compatible
        col1:CopyToRow(col1, 1, 2)
        output frame:ToText()

Parameters

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetAsBoolean(integer index)

Regardless of the type of the column, this action attempts to convert the item at the index to a boolean. Attrribute: Parameter index the item to be converted

Parameters

Return

boolean:

GetAsInteger(integer index)

Regardless of the type of the column, this action attempts to convert the item at the index to an integer. Attrribute: Parameter index the item to be converted

Parameters

Return

integer:

GetAsNumber(integer index)

Regardless of the type of the column, this action attempts to convert the item at the index to a number. Attrribute: Parameter index the item to be converted

Parameters

Return

number:

GetAsText(integer index)

Regardless of the type of the column, this action attempts to convert the item at the index to text. Attrribute: Parameter index the item to be converted

Parameters

Return

text:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetHeader()

This gets the header for this column.

Return

text:

GetSize()

This action returns the number of rows.

Return

integer: The size of the column (number of rows).

GetUndefinedSize()

This action returns the number of items in this column that are undefined.

Return

integer: the number of items that are not defined

GetUndefinedText()

This action returns a default text string for undefined values.

Return

text:

IsBooleanColumn()

This action detects whether this column ultimately stores booleans inside of it. This type of information is implementation dependent, as arbitrary columns can store these values however they see fit.

Return

boolean: true if this column stores booleans

IsIntegerColumn()

This action detects whether this column ultimately stores integers inside of it. This type of information is implementation dependent, as arbitrary columns can store these values however they see fit.

Return

boolean: true if this column stores integers

IsNumberColumn()

This action detects whether this column ultimately stores numbers inside of it. This type of information is implementation dependent, as arbitrary columns can store these numbers however they see fit.

Return

boolean: true if this column stores numbers

IsTextColumn()

This action detects whether this column ultimately stores text inside of it. This type of information is implementation dependent, as arbitrary columns can store these values however they see fit.

Return

boolean: true if this column stores text

IsUndefined(integer row)

This action detects whether a particular index is an undefined value in the column.

Parameters

Return

boolean: true if the row is undefined

Move(integer left, integer right)

This action moves the value in row left to the value in row right.

Parameters

SendValueTo(integer index, Libraries.Compute.Statistics.DataFrameColumnCalculation calculation)

This action sends an individual data point to a calculation, typed appropriately by its subclass.

Parameters

SetAsBoolean(integer index, boolean value)

This action sets the index to a boolean if and only if this is a boolean column. Attrribute: Parameter index the item to be converted

Parameters

SetAsInteger(integer index, integer value)

This action sets the index to an integer if and only if this is an integer column. Attrribute: Parameter index the item to be converted

Parameters

SetAsNumber(integer index, number value)

This action sets the index to a number if and only if this is a number column. Attrribute: Parameter index the item to be converted

Parameters

SetAsText(integer index, text value)

This action sets the index to text if and only if this is a text column. Attrribute: Parameter index the item to be converted

Parameters

SetHeader(text header)

This sets the header for this column.

Parameters

SetSize(integer size)

This action sets the size of the column to the parameter and then fills it with undefined values.

Parameters

Swap(integer left, integer right)

This action swaps two values in the column.

Parameters

ToText()

This is a convenience action that converts the entire column to a text format. This allows it to be sent to the console or a text editor for viewing.

Return

text: a text representation of the entire column