def _dimensions(ds):
    ds = dshape(ds)
    if isinstance(ds, DataShape) and len(ds) == 1:
        ds = ds[0]
    if isinstance(ds, Option):
        return _dimensions(ds.ty)
    if isinstance(ds, Map):
        return max(map(_dimensions, ds.key))
    if isinstance(ds, Record):
        return 1 + max(map(_dimensions, ds.types))
    if isinstance(ds, Tuple):
        return 1 + max(map(_dimensions, ds.dshapes))
    if isinstance(ds, DataShape) and isdimension(ds[0]):
        return 1 + _dimensions(ds.subshape[0])
    if isscalar(ds):
        return 0
    raise TypeError('Cannot count dimensions of dshape %s which is a %r' %
                    (ds, type(ds).__name__))
Parameters:
dataset/ETHPy150Open blaze/datashape/datashape/predicates.py/_dimensions--crossover with--dataset/ETHPy150Open cloudera/impyla/impala/_thrift_gen/ImpalaService/ImpalaService.py/Client.GetRuntimeProfile