DataFrame

The DataFrame Structure

struct DataFrame (
FrameFields...
) if (
FrameFields.length > 0 &&
(
(
!isType!(FrameFields[0]) &&
is(typeof(FrameFields[0]) == bool)
&&
FrameFields[0] == true
&&
FrameFields.length > 1
)
||
isType!(FrameFields[0])
)
) {}

Members

Aliases

FrameType
alias FrameType = staticMap!(toArr, RowType)
Undocumented in source.
FrameType
alias FrameType = toArr!(RowType[0])[RowType.length]
Undocumented in source.
RowType
alias RowType = FrameFields[1..$]
Undocumented in source.
RowType
alias RowType = getArgsList!(FrameFields)
Undocumented in source.

Functions

aggregate
auto aggregate()

Applies mathematical operations on DataFrame row/column

apply
void apply(T index)

void apply(alias Fn, int axis, T)(T index) Description: Applies a function on a particular row or column @params: Fn - Function @params: axis - 0 for rows, 1 for columns @params: index - integer or string indexes of rows

apply
void apply()

void apply(alias Fn, int axis, T)(T index) Description: apply overload - apply to all data @params: Fn - Function @params: axis - 0 for rows, 1 for columns

asSlice
auto asSlice(T index)
Undocumented in source. Be warned that the author may not have intended to support it.
asSlice
auto asSlice()

Get DataFrame data as a Slice

assign
void assign(T index, U values)

void assign(int axis, T, U...)(T index, U values) Description: Assign values to rows or column.index @params: axis - 0 for rows, 1 for column.index @params: index - string[] or integer index of the location to assign @params: values - values to assign

at
RowType[i2] at()

RowTypei2 at(size_t i1, size_t i2)() Description: Getting the element directly from its index @param: ii - Row index @param: i2 - Column index

at
RowType[i2] at(size_t i1)
Undocumented in source. Be warned that the author may not have intended to support it.
at
auto at(size_t i1, size_t i2)
Undocumented in source. Be warned that the author may not have intended to support it.
columnToIndex
auto columnToIndex()

auto columnToIndex(int position)() @property Description: Converts a column into row index level @params: position - integral index of column to be converted to index

display
auto display(bool getStr, int maxwidth)

auto display(bool getStr = false, int maxwidth = 0) Description: Converts the given DataFrame into a formatted string to display on the terminal @params: getStr - returns the string generated. @params: maxwidth - override the width of the terminal.

drop
auto drop()

auto drop(int axis, int[] positions)() @property Description: Drop a row/column from DataFrame @params: axis - 0 for dropping row, 1 for dropping columns @params: positions - integer array of positions of all the rows/colmns to be dropped

fastCSV
void fastCSV(string path, size_t indexDepth, size_t columnDepth, char sep)

from_csv rebuild for faster read

filter
auto filter()

Filter the DataFrame based on the result of callback

from_csv
void from_csv(string path, size_t indexDepth, size_t columnDepth, size_t[] columns, char sep)

void from_csv(string path, size_t indexDepth, size_t columnDepth, size_t[] column.index = [], char sep = ',') Description: Parsing of DataFrame from a CSV file @params: path - File path of csv file @params: indexDepth - Number of column row index span @params: columnDepth - Number of rows column index span @params: column.index - Integer row.index of column to selectively parse @params: sep - Data seperator in the file

getColumnPosition
ptrdiff_t getColumnPosition(string[] indexes)

int getColPos(string[] row.index) Description: Get integer index of the given column headers Defaults to -1 if headers don't match @params: row.index - Array of row.index

getRowPosition
ptrdiff_t getRowPosition(string[] indexes)

int getRowPos(string[] row.index) Description: Get integer index of the given row headers Defaults to -1 if headers don't match @params: row.index - Array of row.index

groupBy
auto groupBy(int[] indexLevels)

Group DataFrame rows based on column values

indexToData
auto indexToData(int indexLevel, string[] dataIndex)

auto indexToData(int position, Dtype...)(int indexLevel, string[] dataIndex) Description: Convers a level of indexing to data @params: position - position to insert data at @params: DataType - Data type for the new data column @params: indexLevel - Index level to convert to data @params: dataIndex - Index for the new data column

opAssign
void opAssign(T input)

Direct assignment of a 2D array to DataFrame Usage: df = [[1,2], [3,4]];

opAssign
void opAssign(Slice!(T*, 2, k) input)

Assign Slice to DataFrame

opIndex
auto opIndex(size_t i1, size_t i2)

Element access based on integral index Usage: df[0, 0]

opIndex
auto opIndex(T rindx, U cindx)

Element access based on integral index Usage: df[["Index1"], ["Index2"]]

opIndex
auto opIndex(string[] index, Args args)

Get an entire row or column using index For column: df[["Index"]] For row: df[["Index"], 0]

opIndexAssign
void opIndexAssign(Args ele, size_t i1, size_t i2)

void opIndexAssign(Args...)(Args ele, size_t i1, size_t i2) Description: Setting the element at an index @param: ii - Row index @param: i2 - Column index

opIndexAssign
void opIndexAssign(Ele ele, string[] rindx, string[] cindx)

void opIndexAssign(Args...)(Args ele, string[] rindx, string[] cindx) Description: Setting the element at an index @param: rindx - Row index @param: cindx - Column index

opIndexAssign
void opIndexAssign(Axis!T elements, string[] index, int axis)

Column/Row binary operations df[["CIndex1"]] = df[["CIndex2"]] + df[["CIndex3"]]; df[["RIndex1"], 0] = df[["RIndex2"], 0] + df[["RIndex3"], 0];

opIndexAssign
void opIndexAssign(Slice!(T*, 1, kind) sl, string[] index, int axis)

Slice assignment operation

opIndexOpAssign
void opIndexOpAssign(Axis!T elements, string[] index, int axis)

Short Hand operations

opIndexOpAssign
void opIndexOpAssign(Slice!(T*, 1, kind) sl, string[] index, int axis)

Slice assignment operation

setFrameIndex
void setFrameIndex(Index index)

void setFrameIndex(Index index) Description: Sets the frame row.index. [Please use setIndex method of Index to set the index] @params: index - Index structure to replace indexing

to_csv
void to_csv(string path, bool writeIndex, bool writeColumn, char sep)

void to_csv(string path, bool writeIndex = true, bool writecolumn.index = true, char sep = ',') Description: Writes given DataFrame to a CSV file @params: path - path to the output file @params: writeIndex - write row index to the file @params: writecolumn.index - write column index to the file @params: sep - data seperator

Variables

cols
size_t cols;
data
FrameType data;

DataFrame Data

indx
Index indx;

DataFrame indexing

isHomogeneousType
enum bool isHomogeneousType;

Flag to know if the DataFrame is homogeneous

rows
size_t rows;

Meta