Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

PERF: optimize Index.delete for dtype=object #7040

Merged
merged 1 commit into from May 5, 2014
Jump to file or symbol
Failed to load files and symbols.
+9 −7
Split
View
@@ -124,8 +124,9 @@ API Changes
- ``concat`` will now concatenate mixed Series and DataFrames using the Series name
or numbering columns as needed (:issue:`2385`)
-- Slicing and advanced/boolean indexing operations on ``Index`` classes will no
- longer change type of the resulting index (:issue:`6440`).
+- Slicing and advanced/boolean indexing operations on ``Index`` classes as well
+ as :meth:`Index.delete` and :meth:`Index.drop` methods will no longer change type of the
+ resulting index (:issue:`6440`, :issue:`7040`)
- ``set_index`` no longer converts MultiIndexes to an Index of tuples (:issue:`6459`).
- Slicing with negative start, stop & step values handles corner cases better (:issue:`6531`):
View
@@ -163,13 +163,15 @@ API changes
- ``concat`` will now concatenate mixed Series and DataFrames using the Series name
or numbering columns as needed (:issue:`2385`). See :ref:`the docs <merging.mixed_ndims>`
-- Slicing and advanced/boolean indexing operations on ``Index`` classes will no
- longer change type of the resulting index (:issue:`6440`)
+- Slicing and advanced/boolean indexing operations on ``Index`` classes as well
+ as :meth:`Index.delete` and :meth:`Index.drop` methods will no longer change type of the
+ resulting index (:issue:`6440`, :issue:`7040`)
.. ipython:: python
i = pd.Index([1, 2, 3, 'a' , 'b', 'c'])
i[[0,1,2]]
+ i.drop(['a', 'b', 'c'])
Previously, the above operation would return ``Int64Index``. If you'd like
to do this manually, use :meth:`Index.astype`
View
@@ -1760,14 +1760,13 @@ def slice_locs(self, start=None, end=None):
def delete(self, loc):
"""
- Make new Index with passed location deleted
+ Make new Index with passed location(-s) deleted
Returns
-------
new_index : Index
"""
- arr = np.delete(self.values, loc)
- return Index(arr)
+ return np.delete(self, loc)
def insert(self, loc, item):
"""