Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #check type
- type(df.index)
- 'pandas.core.index.Float64Index'
- #change type to unicode
- if not isinstance(df.index, unicode):
- df.index = df.index.astype(unicode)
- TypeError: Setting <class 'pandas.core.index.Float64Index'> dtype to anything other than float64 or object is not supported
- # for Python 2
- df.index = df.index.map(unicode)
- # for Python 3 (the unicode type does not exist and is replaced by str)
- df.index = df.index.map(str)
Add Comment
Please, Sign In to add comment