def all_subindices(index):
 return (index[start:stop] for (start, stop) in product_upper_triangle(range((len(index) + 1))))

def all_subindices ( index ) : return ( index [ start : stop ] for ( start , stop ) in product_upper_triangle ( range ( ( len ( index ) + 1 ) ) ) )
return all valid sub-indices of a pandas index .