def delete(self, loc):
new_dates = np.delete(self.asi8, loc)<EOL>freq = None<EOL>if is_integer(loc):<EOL><INDENT>if loc in (<NUM_LIT:0>, -len(self), -<NUM_LIT:1>, len(self) - <NUM_LIT:1>):<EOL><INDENT>freq = self.freq<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if is_list_like(loc):<EOL><INDENT>loc = lib.maybe_indices_to_slice(<EOL>ensure_int64(np.array(loc)), len(self))<EOL><DEDENT>if isinstance(loc, slice) and loc.step in (<NUM_LIT:1>, None):<EOL><INDENT>if (loc.start in (<NUM_LIT:0>, None) or loc.stop in (len(self), None)):<EOL><INDENT>freq = self.freq<EOL><DEDENT><DEDENT><DEDENT>return self._shallow_copy(new_dates, freq=freq)<EOL>
Make a new DatetimeIndex with passed location(s) deleted.

Parameters
----------
loc: int, slice or array of ints
    Indicate which sub-arrays to remove.

Returns
-------
new_index : DatetimeIndex