Inviwo 0.9.12-pre
Inviwo documentation
|
#include <dataframe.h>
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) | |
DataFrame & | operator= (const DataFrame &df) |
DataFrame (DataFrame &&df) | |
DataFrame & | operator= (DataFrame &&df) |
std::shared_ptr< Column > | addColumn (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< Column > | addColumnFromBuffer (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< CategoricalColumn > | addCategoricalColumn (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< CategoricalColumn > | addCategoricalColumn (std::string_view header, const std::vector< std::string > &values) |
std::shared_ptr< Column > | getColumn (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 Column > | getColumn (size_t index) const |
std::shared_ptr< Column > | getColumn (std::string_view name) |
std::shared_ptr< const Column > | getColumn (std::string_view name) const |
std::shared_ptr< IndexColumn > | getIndexColumn () |
std::shared_ptr< const IndexColumn > | getIndexColumn () 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 | |
MetaDataOwner & | operator= (const MetaDataOwner &rhs)=default |
MetaDataOwner & | operator= (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> | |
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 |
MetaDataMap * | getMetaDataMap () |
const MetaDataMap * | getMetaDataMap () 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_ |
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.
void inviwo::DataFrame::dropColumn | ( | size_t | index | ) |
Drop a column from data frame.
Drops the column at the specified position.
index | Position of the column to be dropped |
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.
header | Name of the column to be dropped |
std::shared_ptr< Column > inviwo::DataFrame::getColumn | ( | std::string_view | name | ) |
fetch the first column where the header matches name
.
size_t inviwo::DataFrame::getNumberOfRows | ( | ) | const |
Returns the number of rows of the largest column, excluding the header, or zero if no columns exist.