Skip to content

Series.loc/iloc[x, y] does not raise exception #13831

Closed
@pkch

Description

@pkch

Code Sample, a copy-pastable example if possible

df = pd.DataFrame({'a': [10]})
# df['a'] is a series, can be indexed with 1 index only

# will raise IndexingError, as expected
df['a'].iloc[0, 0]
df['a'].loc[0, 0]

# will raise nothing, not as expected
df['a'].iloc[0, 0] = 1000 # equivalent to pass
df['a'].loc[0, 0] = 1000 # equivalent to df['a'].loc[0] = 1000

See this SO post

Expected Output

Expected an IndexingError exception in every case where two values are used to index a Series.

output of pd.show_versions()

pandas version 0.18.1, python 3.5

Metadata

Metadata

Labels

BugIndexingRelated to indexing on series/frames, not to indexes themselves

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions