IOLink 1.16.1
Loading...
Searching...
No Matches
iolink::DataFrameViewFactory Class Reference

Static Public Member Functions

static std::shared_ptr< DataFrameViewallocate (const Vector2u64 &shape, const std::string *columnNames, const DataType *columnDataTypes)
 This factory is aimed at creating a DataFrame view.
 
static std::shared_ptr< DataFrameViewallocate ()
 This factory aims to create an empty DataFrame view.
 
static std::shared_ptr< DataFrameViewconcatenateRows (std::shared_ptr< DataFrameView > df1, std::shared_ptr< DataFrameView > df2)
 Concatenate the rows of two dataframes.
 
static std::shared_ptr< DataFrameViewfromTensor (std::shared_ptr< TensorView > tensor, const std::string *columnNames, size_t count)
 Create a DataFrameView from a TensorView.
 

Member Function Documentation

◆ allocate() [1/2]

static std::shared_ptr< DataFrameView > iolink::DataFrameViewFactory::allocate ( )
static

This factory aims to create an empty DataFrame view.

Columns and rows can be added later.

◆ allocate() [2/2]

static std::shared_ptr< DataFrameView > iolink::DataFrameViewFactory::allocate ( const Vector2u64 shape,
const std::string *  columnNames,
const DataType columnDataTypes 
)
static

This factory is aimed at creating a DataFrame view.

Parameters
shapeshape of the allocated dataframe (column count, row count)
columnNamesArray which contains the name for each column
columnDataTypesArray which contains the data type of each column
Returns
an in-memory DataFrameView

Vectorial DataTypes are not supported so far.

Warning
No check is done on inputs. Pass arguments very carefully. columnNames and columnDataTypes shall have the same element count, and their size must be equal to shape[0].
column count and row count cannot be 0. To create an empty dataframe, use the parameterless allocate method.
Exceptions
Errorif a DataType is not supported.

◆ concatenateRows()

static std::shared_ptr< DataFrameView > iolink::DataFrameViewFactory::concatenateRows ( std::shared_ptr< DataFrameView df1,
std::shared_ptr< DataFrameView df2 
)
static

Concatenate the rows of two dataframes.

Parameters
df1first dataframe
df2second dataframe whose rows are appended after rows of the first dataframe
Warning
Data of both dataframes is duplicated in the resulting dataframe.

Both dataframe must have the same column count, names and dataTypes. Units are not checked. Only units of the first dataframe are kept.

The resulting dataframe will have the same column count, column names and dataTypes as the input dataframes. Rows of the second dataframe are appended to the rows of the first dataframe.

Exceptions
Errorif the dataframes have different column count, names or dataTypes.
Returns
a new dataframe which is the concatenation of df1 and df2

◆ fromTensor()

static std::shared_ptr< DataFrameView > iolink::DataFrameViewFactory::fromTensor ( std::shared_ptr< TensorView tensor,
const std::string *  columnNames,
size_t  count 
)
static

Create a DataFrameView from a TensorView.

The first dimension of the tensor will be used as the columns axis, and the second dimension as the rows' one.

Parameters
tensorThe source tensor to convert into a DataFrameView.
columnNamesA string containing the names of the columns, separated by commas.
countThe number of element in the columnNames argument.
Returns
A shared pointer to the created DataFrameView.
Exceptions
InvalidArgument If the source tensor is null
InvalidArgument If the tensor is not 2-dimensional
InvalidArgument If the number of column names does not match the first dimension of the tensor

The documentation for this class was generated from the following file: