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

#include <dataframe.h>

+ Inheritance diagram for inviwo::DataFrame:

Public Types

using LookupTable = std::unordered_map<glm::u64, std::string>
 

Public Member Functions

 DataFrame (std::uint32_t size=0)
 
 DataFrame (const DataFrame &df)
 
 DataFrame (const DataFrame &df, const std::vector< std::uint32_t > &rowSelection)
 
DataFrameoperator= (const DataFrame &df)
 
 DataFrame (DataFrame &&df)
 
DataFrameoperator= (DataFrame &&df)
 
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
 
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.
 
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
 
void dropColumn (std::string_view header)
 Drop a column from data frame.
 
void dropColumn (size_t index)
 Drop a column from data frame.
 
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< CategoricalColumnaddCategoricalColumn (std::string_view header, const std::vector< std::string > &values)
 
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
 
std::shared_ptr< IndexColumngetIndexColumn ()
 
std::shared_ptr< const IndexColumngetIndexColumn () const
 
size_t getNumberOfColumns () const
 
size_t getNumberOfRows () const
 
std::vector< std::shared_ptr< Column > >::iterator begin ()
 
std::vector< std::shared_ptr< Column > >::iterator end ()
 
std::vector< std::shared_ptr< Column > >::const_iterator begin () const
 
std::vector< std::shared_ptr< Column > >::const_iterator end () const
 
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
 MetaDataOwner (const MetaDataOwner &rhs)=default
 
 MetaDataOwner (MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (MetaDataOwner &)=default
 
void copyMetaDataFrom (const MetaDataOwner &src)
 
void copyMetaDataTo (MetaDataOwner &dst)
 
template<typename T >
requires std::derived_from<T, MetaData>
T * createMetaData (std::string_view key)
 
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
 
template<typename T , typename U >
requires std::derived_from<T, MetaData> && Gettable<T, U>
getMetaData (std::string_view key, U val) const
 
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
 
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
 
void serialize (Serializer &s) const
 
void deserialize (Deserializer &d)
 

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

◆ 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

◆ 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: