Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::DataFrame Class Reference

#include <inviwo/dataframe/datastructures/dataframe.h>

+ Inheritance diagram for inviwo::DataFrame:

Public Member Functions

std::shared_ptr< CategoricalColumnaddCategoricalColumn (std::string_view header, const std::vector< std::string > &values)
 
std::shared_ptr< CategoricalColumnaddCategoricalColumn (std::string_view header, size_t size=0)
 add a categorical column updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
std::shared_ptr< ColumnaddColumn (std::shared_ptr< Column > column)
 add existing column to DataFrame updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
template<typename T >
std::shared_ptr< TemplateColumn< T > > addColumn (std::string_view header, size_t size=0, Unit unit=Unit{}, std::optional< dvec2 > range=std::nullopt)
 add column of type T updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
template<typename T >
std::shared_ptr< TemplateColumn< T > > addColumn (std::string_view header, std::vector< T > data, Unit unit=Unit{}, std::optional< dvec2 > range=std::nullopt)
 add column of type T from a std::vector<T> updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
std::shared_ptr< ColumnaddColumnFromBuffer (std::string_view identifier, std::shared_ptr< const BufferBase > buffer, Unit unit=Unit{}, std::optional< dvec2 > range=std::nullopt)
 add column based on the contents of the given buffer updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used Note: this will copy the data of buffer.
 
std::vector< std::shared_ptr< Column > >::iterator begin ()
 
std::vector< std::shared_ptr< Column > >::const_iterator begin () const
 
 DataFrame (const DataFrame &rhs)
 
 DataFrame (const DataFrame &rhs, std::span< const std::string > columnSelection)
 
 DataFrame (const DataFrame &rhs, std::span< const std::string > columnSelection, std::span< const std::uint32_t > rowSelection)
 
 DataFrame (const DataFrame &rhs, std::span< const std::uint32_t > rowSelection)
 
 DataFrame (DataFrame &&rhs) noexcept
 
 DataFrame (std::uint32_t size=0)
 
 DataFrame (std::vector< std::shared_ptr< Column > > columns)
 
void dropColumn (size_t index)
 Drop a column from data frame.
 
void dropColumn (std::string_view header)
 Drop a column from data frame.
 
std::vector< std::shared_ptr< Column > >::iterator end ()
 
std::vector< std::shared_ptr< Column > >::const_iterator end () const
 
std::shared_ptr< CategoricalColumngetCategoricalColumn (std::string_view name)
 
std::shared_ptr< const CategoricalColumngetCategoricalColumn (std::string_view name) const
 
CategoricalColumngetCategoricalColumnRef (std::string_view name)
 
const CategoricalColumngetCategoricalColumnRef (std::string_view name) const
 
std::shared_ptr< ColumngetColumn (size_t index)
 access individual columns updateIndexBuffer() needs to be called if the size of the column, i.e. the row count, was changed
 
std::shared_ptr< const ColumngetColumn (size_t index) const
 
std::shared_ptr< ColumngetColumn (std::string_view name)
 
std::shared_ptr< const ColumngetColumn (std::string_view name) const
 
ColumngetColumnRef (std::string_view name)
 
const ColumngetColumnRef (std::string_view name) const
 
std::shared_ptr< IndexColumngetIndexColumn ()
 
std::shared_ptr< const IndexColumngetIndexColumn () const
 
IndexColumngetIndexColumnRef ()
 
const IndexColumngetIndexColumnRef () const
 
size_t getNumberOfColumns () const
 
size_t getNumberOfRows () const
 
DataFrameoperator= (const DataFrame &that)
 
DataFrameoperator= (DataFrame &&that) noexcept
 
void updateIndexBuffer ()
 update row indices. Needs to be called if the row count has changed, i.e. after adding rows from the DataFrame or adding or removing rows from a particular column.
 
- Public Member Functions inherited from inviwo::MetaDataOwner
void copyMetaDataFrom (const MetaDataOwner &src)
 
void copyMetaDataTo (MetaDataOwner &dst)
 
template<typename T >
requires std::derived_from<T, MetaData>
T * createMetaData (std::string_view key)
 
void deserialize (Deserializer &d)
 
template<typename T >
requires std::derived_from<T, MetaData>
T * getMetaData (std::string_view key)
 
template<typename T >
requires std::derived_from<T, MetaData>
const T * getMetaData (std::string_view key) const
 
template<typename T , typename U >
requires std::derived_from<T, MetaData> && Gettable<T, U>
getMetaData (std::string_view key, U val) const
 
MetaDataMapgetMetaDataMap ()
 
const MetaDataMapgetMetaDataMap () const
 
bool hasMetaData (std::string_view key) const
 
template<typename T >
requires std::derived_from<T, MetaData>
bool hasMetaData (std::string_view key) const
 
 MetaDataOwner (const MetaDataOwner &rhs)=default
 
 MetaDataOwner (MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (MetaDataOwner &)=default
 
void serialize (Serializer &s) const
 
template<typename T , typename U >
requires std::derived_from<T, MetaData> && Settable<T, U>
void setMetaData (std::string_view key, U value)
 
template<typename T >
requires std::derived_from<T, MetaData>
bool unsetMetaData (std::string_view key)
 unset, i.e. remove the metadata entry matching the given key and type
 

Additional Inherited Members

- Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_
 

Detailed Description

Table of data for plotting where each column can have a header (title). Missing float/double data is stored as Not a Number (NaN) All columns must have the same number of elements for the DataFrame to be valid.

Member Function Documentation

◆ dropColumn() [1/2]

void inviwo::DataFrame::dropColumn ( size_t index)

Drop a column from data frame.

Drops the column at the specified position.

Parameters
indexPosition of the column to be dropped

◆ dropColumn() [2/2]

void inviwo::DataFrame::dropColumn ( std::string_view header)

Drop a column from data frame.

Drops all columns with the specified header. If the data frame does not have a column with the specified header, nothing happens.

Parameters
headerName of the column to be dropped

◆ getCategoricalColumnRef() [1/2]

CategoricalColumn & inviwo::DataFrame::getCategoricalColumnRef ( std::string_view name)

Fetch the first CategoricalColumn where the header matches name.

Exceptions
throwsan Exception if no matching column was found.
Returns
reference to the column with header matching name.

◆ getCategoricalColumnRef() [2/2]

const CategoricalColumn & inviwo::DataFrame::getCategoricalColumnRef ( std::string_view name) const

Fetch the first CategoricalColumn where the header matches name.

Exceptions
throwsan Exception if no matching column was found.
Returns
reference to the column with header matching name.

◆ getColumn()

std::shared_ptr< Column > inviwo::DataFrame::getColumn ( std::string_view name)

fetch the first column where the header matches name.

Returns
matching column if existing, else nullptr

◆ getColumnRef() [1/2]

Column & inviwo::DataFrame::getColumnRef ( std::string_view name)

Fetch the first Column where the header matches name.

Exceptions
throwsan Exception if no matching column was found.
Returns
reference to the column with header matching name.

◆ getColumnRef() [2/2]

const Column & inviwo::DataFrame::getColumnRef ( std::string_view name) const

Fetch the first Column where the header matches name.

Exceptions
throwsan Exception if no matching column was found.
Returns
reference to the column with header matching name.

◆ getIndexColumnRef() [1/2]

IndexColumn & inviwo::DataFrame::getIndexColumnRef ( )

Fetch the IndexColumn

Exceptions
throwsan Exception if no IndexColumn was found.
Returns
reference to the IndexColumn

◆ getIndexColumnRef() [2/2]

const IndexColumn & inviwo::DataFrame::getIndexColumnRef ( ) const

Fetch the IndexColumn

Exceptions
throwsan Exception if no IndexColumn was found.
Returns
reference to the IndexColumn

◆ getNumberOfRows()

size_t inviwo::DataFrame::getNumberOfRows ( ) const

Returns the number of rows of the largest column, excluding the header, or zero if no columns exist.


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