def insert(self, loc, item):
if isinstance(item, Interval):<EOL><INDENT>if item.closed != self.closed:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>left_insert = item.left<EOL>right_insert = item.right<EOL><DEDENT>elif is_scalar(item) and isna(item):<EOL><INDENT>left_insert = right_insert = item<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>new_left = self.left.insert(loc, left_insert)<EOL>new_right = self.right.insert(loc, right_insert)<EOL>return self._shallow_copy(new_left, new_right)<EOL>
Return a new IntervalIndex inserting new item at location. Follows
Python list.append semantics for negative values.  Only Interval
objects and NA can be inserted into an IntervalIndex

Parameters
----------
loc : int
item : object

Returns
-------
new_index : IntervalIndex