Added inplace to to_index