Skip to content

Commit 64d0097

Browse files
committed
fix period with NaT
1 parent 62f1aec commit 64d0097

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/indexes/period.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from pandas.core.arrays.period import PeriodArray, period_array
3434
from pandas.core.base import _shared_docs
3535
from pandas.core.indexes.base import _index_shared_docs, ensure_index
36+
from pandas.core.missing import isna
3637

3738
from pandas import compat
3839
from pandas.util._decorators import (
@@ -652,7 +653,8 @@ def get_value(self, series, key):
652653
except TypeError:
653654
pass
654655

655-
key = Period(key, self.freq).ordinal
656+
period = Period(key, self.freq)
657+
key = period.value if isna(period) else period.ordinal
656658
return com.maybe_box(self, self._engine.get_value(s, key),
657659
series, key)
658660

0 commit comments

Comments
 (0)