MulDataFrame.nloc#

MulDataFrame.nloc#

Flexible hierachical indexing on the index and columns dataframes using numeric positions.

The row or the columns slicer can be a list or a dict.

If a list is used, it behaves exactly like MulDataFrame.mloc.

If a dict is used, it behaves similarly to MulDataFrame.mloc except that instead of using column names as keys, it uses the numeric positions of the columns as keys.

Examples#

Dictionary indexing:

>>> import pandas as pd
>>> import muldataframe as md
>>> index = pd.DataFrame([[1,2],[3,6],[5,6]],
             index=['a','b','b'],
             columns=['x','y'])
>>> columns = pd.DataFrame([[5,7],[3,6]],
                index=['c','d'],
                columns=['f','g'])
>>> md.nloc[:,{1:6}]
(3,)      g  6
          f  3
             d
-------  ------
   x  y      d
a  1  2  a   2
b  3  6  b   9
b  5  6  b  10
>>> md.nloc[:,{1:[6]}].shape
(3,1)