Index.get_loc()

pandas.Index.get_loc

Index.get_loc(key, method=None, tolerance=None)

Get integer location for requested label

Parameters:

key : label

method : {None, ‘pad’/’ffill’, ‘backfill’/’bfill’, ‘nearest’}, optional

  • default: exact matches only.
  • pad / ffill: find the PREVIOUS index value if no exact match.
  • backfill / bfill: use NEXT index value if no exact match
  • nearest: use the NEAREST index value if no exact match. Tied distances are broken by preferring the larger index value.

tolerance : optional

Maximum distance from index value for in