Does C++ has a data structure similar to Python Pandas' DataFrame?

Is there an existing C++ library that can achieve the similar call-by-name functionalities as Python Pandas' DataFrame?

The particular functionality I want to achieve from this data structure is following:
I am able create a table of data, with column names and row indices. And then, I can call a certain cell's data like: table['ColName'][RowIndex].

Name Sex Age
0 Tom M 20
1 Mary F 23
2 Jerry M 19

Then I can get:
table['Name'][1] = 'Mary'
table['Age'][2] = 19.

Thank you.

Daniel Duffy

C++ author, trainer
Standard C++ not, but it seems you are interested in heterogeneous data types (tuples!), Pandas is jut a whacky name for tuples aka structured or tabular data, yes? If yes, then Boost C++ might come to the rescue

As sidekick Boost C++ Bimap might also come in useful. See

And of course std::tuple in C++11

// TestFusion101.cpp
// Examples from Boost Fusion library.
// (C) Datasim Education BV 2016-2018

#include <vector>
#include <string>
#include <iostream>
#include <algorithm>                                                                                                                   
#include <boost/fusion/sequence.hpp>
#include <boost/fusion/include/sequence.hpp>
#include <boost/fusion/include/algorithm.hpp>

namespace fusion = boost::fusion;

struct Print
template <typename T>
    void operator()(T const& x) const
        std::cout << "Name: " << typeid(x).name() << '\n';

int main()
    fusion::vector<int, char, std::string> tuple(1, 'x', std::string("101"));
    int i = fusion::at_c<0>(tuple);
    char ch = fusion::at_c<1>(tuple);
    std::string s = fusion::at_c<2>(tuple);
    fusion::for_each(tuple, Print());

    return 0;
Last edited:

Daniel Duffy

C++ author, trainer
Hi Professor, Thanks a lot for the idea!
Indeed the Bimap with Boost Multiindex looks like could achieve the SQL-style searching syntax.
I will look into it!
AFAIR I do Bimap in my Adv C++ course.??

// TestDNS.cpp
// Simple DNS lookup with IP addressing and domain names.
// (C) Datasim Education BV 2014

#include <boost/config.hpp>

#include <iostream>
#include <string>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/list_of.hpp>
#include <boost/bimap/unordered_set_of.hpp>

// UUID addresses
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>

// Tags for better readability
struct IpAddress {};
struct DomainName {};

int main()
    using namespace boost::bimaps;

    typedef bimap
        unordered_set_of< tagged< boost::uuids::uuid, DomainName > >,
        unordered_set_of< tagged< std::string, IpAddress > >,

    > DNS;

    DNS dnsDB;

    // We have to use `push_back` because the collection of relations is
    // a `list_of_relation`

    using namespace boost::uuids;

    // Creating uuids. (See Boost II book page 68)
    // From strings.
    string_generator strGen;
    uuid u1 = strGen("00000000-0000-0000-0000-000000000000");
    uuid u2 = strGen("0123456789abcdef0123456789ABCDEF");

    dnsDB.push_back( DNS::value_type(u1, ""));
    dnsDB.push_back( DNS::value_type(u2,""));
    std::cout << "Size of DNS DB; " << dnsDB.size() << std::endl;
    // Search the queried word on the from index (DomainName)

    DNS::map_by<DomainName>::const_iterator name =<DomainName>().find(u1);

    if( name !<DomainName>().end() )
        std::cout << u1 << " has dns name: " << name->get<IpAddress>() << std::endl;
    for( DNS::const_iterator i = dnsDB.begin(), i_end = dnsDB.end(); i != i_end ; ++i )
        std::cout << i->get<DomainName>() << " <---> " << i->get<IpAddress>() << std::endl;
    return 0;
Last edited: