Advertisement
Venciity

Untitled

Sep 23rd, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import pandas.util.testing as tm
  2.  
  3. # Creating a toy df
  4. df = tm.makeTimeDataFrame()
  5. df.index = df.index.map(lambda x: x.map(lambda y: str(y)[:10]))
  6.  
  7. # Move an index to desirable location
  8. selected_index = '2000-02-11'
  9. selected_row = df[df.index == selected_index]
  10. df = df.drop(selected_index, axis = 0)
  11. selected_row.append(df)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement