invert dataset pandas code example Example 1: reverse pd based on index data.iloc[::-1] Example 2: reverse pd based on index data.reindex(index=data.index[::-1])