def get_value(self, series, key):
s = com.values_from_object(series)<EOL>try:<EOL><INDENT>return com.maybe_box(self,<EOL>super().get_value(s, key),<EOL>series, key)<EOL><DEDENT>except (KeyError, IndexError):<EOL><INDENT>try:<EOL><INDENT>asdt, parsed, reso = parse_time_string(key, self.freq)<EOL>grp = resolution.Resolution.get_freq_group(reso)<EOL>freqn = resolution.get_freq_group(self.freq)<EOL>vals = self._ndarray_values<EOL>if grp < freqn:<EOL><INDENT>iv = Period(asdt, freq=(grp, <NUM_LIT:1>))<EOL>ord1 = iv.asfreq(self.freq, how='<STR_LIT:S>').ordinal<EOL>ord2 = iv.asfreq(self.freq, how='<STR_LIT:E>').ordinal<EOL>if ord2 < vals[<NUM_LIT:0>] or ord1 > vals[-<NUM_LIT:1>]:<EOL><INDENT>raise KeyError(key)<EOL><DEDENT>pos = np.searchsorted(self._ndarray_values, [ord1, ord2])<EOL>key = slice(pos[<NUM_LIT:0>], pos[<NUM_LIT:1>] + <NUM_LIT:1>)<EOL>return series[key]<EOL><DEDENT>elif grp == freqn:<EOL><INDENT>key = Period(asdt, freq=self.freq).ordinal<EOL>return com.maybe_box(self, self._engine.get_value(s, key),<EOL>series, key)<EOL><DEDENT>else:<EOL><INDENT>raise KeyError(key)<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT>period = Period(key, self.freq)<EOL>key = period.value if isna(period) else period.ordinal<EOL>return com.maybe_box(self, self._engine.get_value(s, key),<EOL>series, key)<EOL><DEDENT>
Fast lookup of value from 1-dimensional ndarray. Only use this if you
know what you're doing