Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
NaNs in Float64Index are converted to silly integers using index.astype('int') #13149
Comments
|
This is numpy behaviour:
But, we should probably check for the occurence of NaNs, just as we do for Series:
|
jorisvandenbossche
added Bug Dtypes
labels
May 12, 2016
jorisvandenbossche
added this to the
Next Major Release
milestone
May 12, 2016
jreback
added Difficulty Novice Effort Low
labels
May 12, 2016
|
I wanted to fix this bug but noticed a similar behaviour of other objects: DatetimeIndex, TimedeltaIndex, Categorical, CategoricalIndex. Namely (all four of them behave identically):
However, unlike with Float64Index, this is invertible:
My question: is this behaviour also a bug and should be fixed the same way (raising a ValueError)? And if so, should all the fixes be placed into one commit/pull request? By the way, there might be other objects with the same issue, which call numpy.ndarray.astype(). And numpy is also a bit inconsistent here:
|
|
@ch41rmn these are all as expected. converting to The only issue is that |
|
@jreback I actually think we should raise in the datetimeindex case as well (ideally). A |
|
Raising for CategoricalIndex seems less of a problem (not a common thing to do) |
|
This is excactly what should be returned (and is useful). yes its equivalen to internal
|
pijucha
referenced
this issue
May 17, 2016
Closed
BUG: Fix #13149 and ENH: 'copy' param in Index.astype() #13209
pijucha
added a commit
to pijucha/pandas
that referenced
this issue
May 23, 2016
|
|
pijucha + pijucha |
8b29902
|
jreback
closed this
in afde718
May 23, 2016
nps
added a commit
to nps/pandas
that referenced
this issue
May 30, 2016
|
|
pijucha + nps |
9a4b5d5
|
ch41rmn commentedMay 12, 2016
Code Sample, a copy-pastable example if possible
output of
pd.show_versions()