Guest User

Untitled

a guest
Feb 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #check type
  2. type(df.index)
  3. 'pandas.core.index.Float64Index'
  4.  
  5. #change type to unicode
  6. if not isinstance(df.index, unicode):
  7. df.index = df.index.astype(unicode)
  8.  
  9. TypeError: Setting <class 'pandas.core.index.Float64Index'> dtype to anything other than float64 or object is not supported
  10.  
  11. # for Python 2
  12. df.index = df.index.map(unicode)
  13.  
  14. # for Python 3 (the unicode type does not exist and is replaced by str)
  15. df.index = df.index.map(str)
Add Comment
Please, Sign In to add comment