Repository: pandas-dev/pandas

Issue:
Float Index Interpreted as Object dtype
When I cast a FloatIndex to a numpy array, I get an array of objects.  The desired behavior should be float.  This is backwards incompatible with pre-FloatIndex behavior.  

``` python
In [119]:   s = pd.Series([1,2,3],[1.,2.,3.])
               array(s.index).dtype

Out[119]:  dtype('O')
```

The Int64Index works as expected.

``` python
In [114]:    s = pd.Series([1,2,3],[1,2,3])
                array(s.index).dtype

Out[114]:  dtype('int64')
```



Discussion:
this is the same as 0.12

a Float64Index is actually object dtype as it makes exact matching floats easier

is their a reason you think the implementation matters here?

I'm running into issues where the new index is breaking code...  Here is a toy example:

``` python
In [171]:

s = pd.Series([1,2,3],[1.,2.,3.])
d = pd.Series(s.index, s.index)
d.idxmax()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-171-89e600a2d902> in <module>()
      1 s = pd.Series([1,2,3],[1.,2.,3.])
      2 d = pd.Series(s.index, s.index)
----> 3 d.idxmax()

/cellar/users/agross/anaconda2/lib/python2.7/site-packages/pandas-0.13.0_120_gdd89ce4-py2.7-linux-x86_64.egg/pandas/core/series.pyc in idxmax(self, axis, out, skipna)
   1276         DataFrame.idxmax
   1277         """
-> 1278         i = nanops.nanargmax(_values_from_object(self), skipna=skipna)
   1279         if i == -1:
   1280             return pa.NA

/cellar/users/agross/anaconda2/lib/python2.7/site-packages/pandas-0.13.0_120_gdd89ce4-py2.7-linux-x86_64.egg/pandas/core/nanops.pyc in nanargmax(values, axis, skipna)
    373     """
    374     values, mask, dtype = _get_values(values, skipna, fill_value_typ='-inf',
--> 375                                       isfinite=True)
    376     result = values.argmax(axis)
    377     result = _maybe_arg_null_out(result, axis, mask, skipna)

/cellar/users/agross/anaconda2/lib/python2.7/site-packages/pandas-0.13.0_120_gdd89ce4-py2.7-linux-x86_64.egg/pandas/core/nanops.pyc in _get_values(values, skipna, fill_value, fill_value_typ, isfinite, copy)
    139     values = _values_from_object(values)
    140     if isfinite:
--> 141         mask = _isfinite(values)
    142     else:
    143         mask = isnull(values)

/cellar/users/agross/anaconda2/lib/python2.7/site-packages/pandas-0.13.0_120_gdd89ce4-py2.7-linux-x86_64.egg/pandas/core/nanops.pyc in _isfinite(values)
    172     if issubclass(values.dtype.type, (np.timedelta64, np.datetime64)):
    173         return isnull(values)
--> 174     return -np.isfinite(values)
    175 
    176 

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
```

ok let me look at that
prob a bug


Resolving patch:
diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -171,6 +171,9 @@ def _get_values(values, skipna, fill_value=None, fill_value_typ=None,
 def _isfinite(values):
     if issubclass(values.dtype.type, (np.timedelta64, np.datetime64)):
         return isnull(values)
+    elif isinstance(values.dtype, object):
+        return -np.isfinite(values.astype('float64'))
+
     return -np.isfinite(values)
 
 


Test patch:
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -3258,6 +3258,20 @@ def test_idxmax(self):
         result = s.idxmax()
         self.assert_(result == 4)
 
+        # Float64Index
+        # GH 5914
+        s = pd.Series([1,2,3],[1.1,2.1,3.1])
+        result = s.idxmax()
+        self.assert_(result == 3.1)
+        result = s.idxmin()
+        self.assert_(result == 1.1)
+
+        s = pd.Series(s.index, s.index)
+        result = s.idxmax()
+        self.assert_(result == 3.1)
+        result = s.idxmin()
+        self.assert_(result == 1.1)
+
     def test_ndarray_compat(self):
 
         # test numpy compat with Series as sub-class of NDFrame