Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. In [1]: df = pd.DataFrame({'a': [True, False], 'b': [1, 2]})
  2.  
  3. In [2]: df['a'].dtype
  4. Out [2]: dtype('bool')
  5.  
  6. In [3]: df.set_index('a', inplace=True)
  7.  
  8. In [4]: df.index
  9. Out [4]: Index([True, False], dtype='object', name='a')
  10.  
  11. In [5]: df.reset_index(inplace=True)
  12. df.set_index('b', inplace=True)
  13. df.index
  14. Out [5]: Int64Index([1, 2], dtype='int64', name='b')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement