IOLink Python 1.11.0
Loading...
Searching...
No Matches
iolink.iolink.DataFrameView Class Reference
Inheritance diagram for iolink.iolink.DataFrameView:
iolink.iolink.View

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 get_capabilities (self)
 
 get_shape (self)
 
 column_name (self, index)
 
 column_index (self, name)
 
 column_data_type (self, index)
 
 unit (self, columnIndex)
 
 set_unit (self, columnIndex, unit)
 
 add_column (self, name, dtype)
 
 add_rows (self, offset, count)
 
 remove_column (self, index)
 
 remove_rows (self, offset, count)
 
 to_string (self)
 
 to_pointer (self)
 
 read (self, column, offset, count, dst=None)
 
 write (self, column, offset, count, src)
 
 at (self, column, row)
 
 set_at (self, column, row, value)
 
 __repr__ (self)
 
 reshape (self, shape=None, columnNames=[], columnDataTypes=[])
 

Static Public Member Functions

 create_from_pointer (imagePtr)
 

Static Public Attributes

 column = self.column_index(column)
 
 dtype = self.column_data_type(column)
 
list dst = [str(i) for i in range(count)]
 
 dst = create_array_from_datatype(dtype, [i for i in range(count)])
 
 totalElementCount = dtype.element_count * count
 
 byteArrOut = bytearray(totalElementCount * dtype.byte_count())
 
 arrayOut = create_array_from_datatype(dtype, byteArrOut)
 
 dstOut = arrayOut.tolist()
 
 arrayO = create_array_from_datatype(dtype, src)
 
int MINIMAL_SPACE_BETWEEN_COLUMN = 2
 
int MINIMAL_COLUMN_WIDTH = 8
 
int MAXIMAL_COLUMN_WIDTH = 30
 
int MAXIMAL_LINE_COUNT = 30
 
int MAXIMAL_COLUMN_COUNT = 80
 
str SKIPPED_CONTENT = "..."
 
int SKIPPED_CONTENT_INDEX = -1
 
 strVal = str(self.at(idxCol, idxRow))
 
 columnWidth = max(columnWidth, len(columnContent[idxCol][idxRow]))
 
 columnsWidthSum = columnsWidth[0] + columnsWidth[columnCount - 1];
 
int idxColumn = 1;
 

Protected Member Functions

 _reshape (self, shape, columnNames, columnDataTypes)
 
 _read_bytes (self, column, offset, count, dst)
 
 _write_bytes (self, column, offset, count, src)
 
 _read_strings (self, column, offset, count, dst)
 
 _write_strings (self, column, offset, count, src)
 
 _at (self, column, row)
 
 _set_at (self, column, row, pyValue)
 
 _readValuesForDisplayedRows (self, rowIndexToDisplay)
 
 _determineRowsToDisplay (self)
 
 _determineColumnsToDisplay (self, columnContent)
 
 _writeTable (self, columnsToDisplay, rowIndexToDisplay, columnContentString)
 
 _as_html (self)
 
 _repr_html_ (self)
 

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 
 capabilities = property(get_capabilities, doc=get_capabilities.__doc__)
 
 shape = property(get_shape, doc=get_capabilities.__doc__)
 

Detailed Description

View to model tabular data.

This view is composed of a set of columns, that have a name and a data type.
A column's name is unique, and columns in a dataframe can have different data
types.

Each column has the same number of elements.
The aggregate of all n-th elements of columns are a row of the dataframe.

Constructor & Destructor Documentation

◆ __init__()

iolink.iolink.DataFrameView.__init__ (   self,
args,
**  kwargs 
)

Reimplemented from iolink.iolink.View.

Member Function Documentation

◆ __repr__()

iolink.iolink.DataFrameView.__repr__ (   self)

Reimplemented from iolink.iolink.View.

◆ _reshape()

iolink.iolink.DataFrameView._reshape (   self,
  shape,
  columnNames,
  columnDataTypes 
)
protected
    Method to reshape a DataFrame

    This method requires the RESHAPE capability.

    All the dataframe's data is invalidated after this operation.

    :type shape: :py:class:`Vector2u64`
    :param shape: shape of the allocated dataframe (column count, row count)
    :type columnNames: string
    :param columnNames: Array which contains the name for each column
    :type columnDataTypes: :py:class:`DataType`
    :param columnDataTypes: Array which contains the data type of each column

    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.

◆ add_column()

iolink.iolink.DataFrameView.add_column (   self,
  name,
  dtype 
)
    Add a column to the dataframe.

    This method requires the RESHAPE capability.

    The new column's data will be undefined after addition.

    :type name: string
    :param name: The name of the new column.
    :type dtype: :py:class:`DataType`
    :param dtype: The type of data stored in the column.

    :raises: NotImplemented When the view does not support reshaping.
    :raises: Error if there is already a column with the same name.
    :raises: Error if the implementation does not support the data type.

◆ add_rows()

iolink.iolink.DataFrameView.add_rows (   self,
  offset,
  count 
)
    Insert rows at the specified position.

    This method requires the RESHAPE capability.

    New rows content will be undefined after insertion.

    :type offset: int
    :param offset: New rows will be inserted before this row. If the offset is
                      the number of rows in the dataframe, rows will be inserted at
                      the end.
    :type count: int
    :param count: The number of rows to insert.

    :raises: NotImplemented When the view does not support reshaping.
    :raises: Error When offset is out of bounds.
    :raises: Error When it is impossible to add these rows.

◆ at()

iolink.iolink.DataFrameView.at (   self,
  column,
  row 
)
Get the value stored in a cell of the data frame.

:type column: int
:param column: The index of the column
:type row: int
:param row: The index of the row
:return: The value of the cell at the given index.

◆ column_data_type()

iolink.iolink.DataFrameView.column_data_type (   self,
  index 
)
    Return the data type of the column.

    :type index: int
    :param index: The index of the column.

    :raises: Error When index is out of range.

◆ column_index()

iolink.iolink.DataFrameView.column_index (   self,
  name 
)
    Get the index of a column from its name.

    :type name: string
    :param name: The name of the column.

    :raises: Error If there is no column with that name.

◆ column_name()

iolink.iolink.DataFrameView.column_name (   self,
  index 
)
    Get the name of a column from its index.

    Column indices go from 0 to shape[0] - 1.

    :type index: int
    :param index: The index of the column.

    :raises: Error If index is out of range.

◆ create_from_pointer()

iolink.iolink.DataFrameView.create_from_pointer (   imagePtr)
static
    Create a new Python DataFrameView instance from a C++ pointer.

    :type imagePtr: int
    :param imagePtr: a pointer to a DataFrameView shared pointer as an int.
    :rtype: PyObject
    :return: the python instance created from the C++ pointer.

◆ get_capabilities()

iolink.iolink.DataFrameView.get_capabilities (   self)
    Return the view's capabilities

    See also: DataFrameCapability

◆ get_shape()

iolink.iolink.DataFrameView.get_shape (   self)
    Return the shape of the data frame.

    First element being the number of columns, and the second, the number of rows.

◆ read()

iolink.iolink.DataFrameView.read (   self,
  column,
  offset,
  count,
  dst = None 
)
Read data from a column into the destination.

If dst is set as None, this method will return read values as an array.

:type column: int
:param column: The index of the column
:type offset: int
:param offset: The index of the first row to read
:type count: int
:param count: The count of rows to read
:type dst: bytearray or any mutable container
:param dst: destination buffer where read data are copied

◆ remove_column()

iolink.iolink.DataFrameView.remove_column (   self,
  index 
)
    Remove a column.

    This method requires the RESHAPE capability.

    :type index: int
    :param index: The index of the column to remove.

    :raises: NotImplemented When the view does not support reshaping.
    :raises: Error If the index is out of bounds.
    :raises: Error When it is impossible to remove that column.

◆ remove_rows()

iolink.iolink.DataFrameView.remove_rows (   self,
  offset,
  count 
)
    Remove a continuous set of rows.

    This method requires the RESHAPE capability.

    :type offset: int
    :param offset: The index of the first column to remove.
    :type count: int
    :param count: Row count to delete.

    :raises: NotImplemented When the view does not support reshaping.
    :raises: Error When offset is out of bounds.
    :raises: Error When it is impossible to remove these rows.

◆ reshape()

iolink.iolink.DataFrameView.reshape (   self,
  shape = None,
  columnNames = [],
  columnDataTypes = [] 
)
Entirely reshape the current data frame using given parameters.

:type shape: Vector2u64
:param shape: The new shape for the data frame. If not defined, column count is deduced from other parameters. Row count is 0.
:type columnNames: list
:param columnNames: list of column names
:type columnDataTypes: list
:param columnDataTypes: list of column datatypes

◆ set_at()

iolink.iolink.DataFrameView.set_at (   self,
  column,
  row,
  value 
)
Set the element value in a cell of the data frame.

:type column: int
:param column: The index of the column
:type row: int
:param row: The index of the row
:param value: The value to store in the cell

◆ to_pointer()

iolink.iolink.DataFrameView.to_pointer (   self)
Get the internal C++ pointer as an integer.

◆ to_string()

iolink.iolink.DataFrameView.to_string (   self)
Return a string representation

◆ write()

iolink.iolink.DataFrameView.write (   self,
  column,
  offset,
  count,
  src 
)
Write data into a column from the destination.

:type column: int
:param column: The index of the column
:type offset: int
:param offset: The index of the first row to read
:type count: int
:param count: The count of rows to read
:type src: bytearray or any mutable container
:param src: source buffer which contains data to write

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