Skip to content

BUG: fix iat and at for Float64Index #8094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/source/v0.15.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ Bug Fixes




- Bug in ``Float64Index`` where ``iat`` and ``at`` were not testing and were
failing (:issue:`8092`).



Expand Down
3 changes: 2 additions & 1 deletion pandas/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down