def index_bounds(x):
    """returns tuple with first and last item"""
    if isinstance(x, (pd.DataFrame, pd.Series)):
        return x.iloc[0], x.iloc[-1]
    else:
        return x[0], x[-1]
def index_bounds ( x ) : if isinstance ( x , ( pd . DataFrame , pd . Series ) ) : return x . iloc [ 0 ] , x . iloc [ - 1 ] else : return x [ 0 ] , x [ - 1 ]
returns tuple with first and last item