Repository: pandas-dev/pandas

Issue:
.at and .iat indexing with Float64Index
Using .at and .iat indexing with a Float64Index produces an error:

``` python

In [0]: import pandas as pd
In [1]: s = pd.Series([1,2,3], index = [0.1,0.2,0.3])
In [2]: s.at[0.1]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-a5888722fbca> in <module>()
----> 1 s.at[0.1]

/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/pandas/core/indexing.pyc in __getitem__(self, key)
   1264 
   1265         key = self._convert_key(key)
-> 1266         return self.obj.get_value(*key)
   1267 
   1268     def __setitem__(self, key, value):

/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/pandas/core/series.pyc in get_value(self, label)
    778         value : scalar value
    779         """
--> 780         return self.index.get_value(self.values, label)
    781 
    782     def set_value(self, label, value):

/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/pandas/core/index.pyc in get_value(self, series, key)
   1821         k = _values_from_object(key)
   1822         loc = self.get_loc(k)
-> 1823         new_values = series.values[loc]
   1824         if np.isscalar(new_values):
   1825             return new_values

AttributeError: 'numpy.ndarray' object has no attribute 'values'

In [3]: s.iat[1]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-db1ebf8cc8e6> in <module>()
----> 1 s.iat[1]

/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/pandas/core/indexing.pyc in __getitem__(self, key)
   1264 
   1265         key = self._convert_key(key)
-> 1266         return self.obj.get_value(*key)
   1267 
   1268     def __setitem__(self, key, value):

/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/pandas/core/series.pyc in get_value(self, label)
    778         value : scalar value
    779         """
--> 780         return self.index.get_value(self.values, label)
    781 
    782     def set_value(self, label, value):

/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/pandas/core/index.pyc in get_value(self, series, key)
   1821         k = _values_from_object(key)
   1822         loc = self.get_loc(k)
-> 1823         new_values = series.values[loc]
   1824         if np.isscalar(new_values):
   1825             return new_values

AttributeError: 'numpy.ndarray' object has no attribute 'values'

```

I'm not sure if this is intended behavoir. The docs only talk about [], loc, iloc and ix indexing with Float64Index, but if so, perhaps a more useful error message would be in order. I wasn't even aware my index was Float64. Its gotten changed at some point without me being aware of it. 



Discussion:
yep, was not tested, so broken. work-around is `.loc/.iloc`

pull-requests welcome as well!

pr coming


Resolving patch:
diff --git a/pandas/core/index.py b/pandas/core/index.py
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -2309,7 +2309,8 @@ def get_value(self, series, key):
 
         k = _values_from_object(key)
         loc = self.get_loc(k)
-        new_values = series.values[loc]
+        new_values = _values_from_object(series)[loc]
+
         if np.isscalar(new_values) or new_values is None:
             return new_values
 


Test patch:
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -3818,6 +3818,13 @@ def test_float_index_non_scalar_assignment(self):
         df.loc[df.index] = df.loc[df.index]
         tm.assert_frame_equal(df,df2)
 
+    def test_float_index_at_iat(self):
+        s = pd.Series([1, 2, 3], index=[0.1, 0.2, 0.3])
+        for el, item in s.iteritems():
+            self.assertEqual(s.at[el], item)
+        for i in range(len(s)):
+            self.assertEqual(s.iat[i], i + 1)
+
 
 class TestSeriesNoneCoercion(tm.TestCase):
     EXPECTED_RESULTS = [