should single item access throw Error
if we have a dios like this:
>>>d.loc[5:7]
a b c d
------ ------ ------ ----------
5 5 5 5 5 5 5 8.50
6 6 6 6 7 7 6 9.25
7 7 7 7 7 10.00
and we access a single row (eg. 7
) or a list of rows ([6,7]
) and a single key is not present in all columns, we throw an KeyError
.
We could easily change the behaivior to return a empty series at the missing location instead, and only throw a KeyError
if the key is missing in every column.
the current behaviour
>>>d.loc[6]
Traceback (most recent call last):
...
...
raise KeyError(f"'{key}'")
KeyError: "'6'"
suggested behaviour
>>>d.loc[6]
a b c d
------ ------ ------------ ---------
6 6 6 6 Series([], ) 6 9.25