diff --git a/RELEASE.rst b/RELEASE.rst index 46f7c832ae149..291f1f8bf0f33 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -49,6 +49,8 @@ pandas 0.11.0 - Added support for expression evaluation using the ``numexpr`` library - Added ``convert=boolean`` to ``take`` routines to translate negative indices to positive, defaults to True + - Added to_series() method to indices, to facilitate the creation of indexeres + (GH3275_) **Improvements to existing features** @@ -277,6 +279,7 @@ pandas 0.11.0 .. _GH1893: https://github.com/pydata/pandas/issues/1893 .. _GH1978: https://github.com/pydata/pandas/issues/1978 .. _GH2758: https://github.com/pydata/pandas/issues/2758 +.. _GH3275: https://github.com/pydata/pandas/issues/3275 .. _GH2121: https://github.com/pydata/pandas/issues/2121 .. _GH3247: https://github.com/pydata/pandas/issues/3247 .. _GH2809: https://github.com/pydata/pandas/issues/2809 diff --git a/doc/source/v0.11.0.txt b/doc/source/v0.11.0.txt index c6553b909f7a6..331bbfaf1a2e8 100644 --- a/doc/source/v0.11.0.txt +++ b/doc/source/v0.11.0.txt @@ -226,6 +226,9 @@ Astype conversion on ``datetime64[ns]`` to ``object``, implicity converts ``NaT` API changes ~~~~~~~~~~~ + - Added to_series() method to indicies, to facilitate the creation of indexers + (GH3275_) + - In ``HDFStore``, added the method ``select_column`` to select a single column from a table as a Series. - In ``HDFStore``, deprecated the ``unique`` method, can be replicated by ``select_column(key,column).unique()`` @@ -343,6 +346,7 @@ on GitHub for a complete list. .. _GH2807: https://github.com/pydata/pandas/issues/2807 .. _GH2918: https://github.com/pydata/pandas/issues/2918 .. _GH2758: https://github.com/pydata/pandas/issues/2758 +.. _GH3275: https://github.com/pydata/pandas/issues/3275 .. _GH2979: https://github.com/pydata/pandas/issues/2979 .. _GH3011: https://github.com/pydata/pandas/issues/3011 .. _GH3076: https://github.com/pydata/pandas/issues/3076 diff --git a/pandas/core/index.py b/pandas/core/index.py index ac352eef4acfe..aa0fd5b6b0351 100644 --- a/pandas/core/index.py +++ b/pandas/core/index.py @@ -188,6 +188,14 @@ def __repr__(self): """ return str(self) + def to_series(self): + """ + return a series with both index and values equal to the index keys + useful with map for returning an indexer based on an index + """ + import pandas as pd + return pd.Series(self.values,index=self,name=self.name) + def astype(self, dtype): return Index(self.values.astype(dtype), name=self.name, dtype=dtype)