def _find_valid_index(self, how):
assert how in ['<STR_LIT>', '<STR_LIT>']<EOL>if len(self) == <NUM_LIT:0>:  <EOL><INDENT>return None<EOL><DEDENT>is_valid = ~self.isna()<EOL>if self.ndim == <NUM_LIT:2>:<EOL><INDENT>is_valid = is_valid.any(<NUM_LIT:1>)  <EOL><DEDENT>if how == '<STR_LIT>':<EOL><INDENT>idxpos = is_valid.values[::].argmax()<EOL><DEDENT>if how == '<STR_LIT>':<EOL><INDENT>idxpos = len(self) - <NUM_LIT:1> - is_valid.values[::-<NUM_LIT:1>].argmax()<EOL><DEDENT>chk_notna = is_valid.iat[idxpos]<EOL>idx = self.index[idxpos]<EOL>if not chk_notna:<EOL><INDENT>return None<EOL><DEDENT>return idx<EOL>
Retrieves the index of the first valid value.

Parameters
----------
how : {'first', 'last'}
    Use this parameter to change between the first or last valid index.

Returns
-------
idx_first_valid : type of index