Currently, Index.unique
returns ndarray
but DatetimeIndex.unique
returns DatetimeIndex
to preserve datetime information. I think PeriodIndex.unique
should also return PeriodIndex
(currently it returns ndarray
).
I'd like to ask which is better to fix all Index.unique
to return Index
for consistency, or only fix PeriodIndex
.
didx = pd.DatetimeIndex([datetime.datetime(2014, 1, 1), datetime.datetime(2014, 2, 1)])
didx.unique()
# <class 'pandas.tseries.index.DatetimeIndex'>
# [2014-01-01, 2014-02-01]
pidx = pd.PeriodIndex(['2014-01', '2014-02'], freq='M')
pidx.unique()
# [528 529]
type(pidx.unique())
# <type 'numpy.ndarray'>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4