Skip to content
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
2 changes: 2 additions & 0 deletions doc/source/v0.14.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,5 @@ Bug Fixes

- Bug in non-monotonic ``Index.union`` may preserve ``name`` incorrectly (:issue:`7458`)
- Bug in ``DatetimeIndex.intersection`` doesn't preserve timezone (:issue:`4690`)

- Bug in ``Float64Index`` assignment with a non scalar indexer (:issue:`7586`)
2 changes: 1 addition & 1 deletion pandas/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,7 @@ def __contains__(self, other):

def get_loc(self, key):
try:
if np.isnan(key):
if np.all(np.isnan(key)):
try:
return self._nan_idxs.item()
except ValueError:
Expand Down
12 changes: 12 additions & 0 deletions pandas/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3684,6 +3684,18 @@ def test_duplicate_ix_returns_series(self):
e = df.loc[0.2, 'a']
tm.assert_series_equal(r, e)

def test_float_index_non_scalar_assignment(self):
df = DataFrame({'a': [1,2,3], 'b': [3,4,5]},index=[1.,2.,3.])
df.loc[df.index[:2]] = 1
expected = DataFrame({'a':[1,1,3],'b':[1,1,5]},index=df.index)
tm.assert_frame_equal(expected, df)

df = DataFrame({'a': [1,2,3], 'b': [3,4,5]},index=[1.,2.,3.])
df2 = df.copy()
df.loc[df.index] = df.loc[df.index]
tm.assert_frame_equal(df,df2)



if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
Expand Down