Series.loc/iloc[x, y] does not raise exception (original) (raw)

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