def first_valid_index(self) -> Optional[Union[(Scalar, Tuple[(Scalar, ...)])]]:
    "\n        Retrieves the index of the first valid value.\n\n        Returns\n        -------\n        scalar, tuple, or None\n\n        Examples\n        --------\n\n        Support for DataFrame\n\n        >>> psdf = ps.DataFrame({'a': [None, 2, 3, 2],\n        ...                     'b': [None, 2.0, 3.0, 1.0],\n        ...                     'c': [None, 200, 400, 200]},\n        ...                     index=['Q', 'W', 'E', 'R'])\n        >>> psdf\n             a    b      c\n        Q  NaN  NaN    NaN\n        W  2.0  2.0  200.0\n        E  3.0  3.0  400.0\n        R  2.0  1.0  200.0\n\n        >>> psdf.first_valid_index()\n        'W'\n\n        Support for MultiIndex columns\n\n        >>> psdf.columns = pd.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])\n        >>> psdf\n             a    b      c\n             x    y      z\n        Q  NaN  NaN    NaN\n        W  2.0  2.0  200.0\n        E  3.0  3.0  400.0\n        R  2.0  1.0  200.0\n\n        >>> psdf.first_valid_index()\n        'W'\n\n        Support for Series.\n\n        >>> s = ps.Series([None, None, 3, 4, 5], index=[100, 200, 300, 400, 500])\n        >>> s\n        100    NaN\n        200    NaN\n        300    3.0\n        400    4.0\n        500    5.0\n        dtype: float64\n\n        >>> s.first_valid_index()\n        300\n\n        Support for MultiIndex\n\n        >>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'],\n        ...                       ['speed', 'weight', 'length']],\n        ...                      [[0, 0, 0, 1, 1, 1, 2, 2, 2],\n        ...                       [0, 1, 2, 0, 1, 2, 0, 1, 2]])\n        >>> s = ps.Series([None, None, None, None, 250, 1.5, 320, 1, 0.3], index=midx)\n        >>> s\n        lama    speed       NaN\n                weight      NaN\n                length      NaN\n        cow     speed       NaN\n                weight    250.0\n                length      1.5\n        falcon  speed     320.0\n                weight      1.0\n                length      0.3\n        dtype: float64\n\n        >>> s.first_valid_index()\n        ('cow', 'weight')\n        "
    data_spark_columns = self._internal.data_spark_columns
    if (len(data_spark_columns) == 0):
        return None
    cond = reduce((lambda x, y: (x & y)), map((lambda x: x.isNotNull()), data_spark_columns))
    with sql_conf({SPARK_CONF_ARROW_ENABLED: False}):
        first_valid_row = cast(pd.DataFrame, self._internal.spark_frame.filter(cond).select(self._internal.index_spark_columns).limit(1).toPandas())
    if (len(first_valid_row) == 0):
        return None
    first_valid_row = first_valid_row.iloc[0]
    if (len(first_valid_row) == 1):
        return first_valid_row.iloc[0]
    else:
        return tuple(first_valid_row)
Retrieves the index of the first valid value.

Returns
-------
scalar, tuple, or None

Examples
--------

Support for DataFrame

>>> psdf = ps.DataFrame({'a': [None, 2, 3, 2],
...                     'b': [None, 2.0, 3.0, 1.0],
...                     'c': [None, 200, 400, 200]},
...                     index=['Q', 'W', 'E', 'R'])
>>> psdf
     a    b      c
Q  NaN  NaN    NaN
W  2.0  2.0  200.0
E  3.0  3.0  400.0
R  2.0  1.0  200.0

>>> psdf.first_valid_index()
'W'

Support for MultiIndex columns

>>> psdf.columns = pd.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])
>>> psdf
     a    b      c
     x    y      z
Q  NaN  NaN    NaN
W  2.0  2.0  200.0
E  3.0  3.0  400.0
R  2.0  1.0  200.0

>>> psdf.first_valid_index()
'W'

Support for Series.

>>> s = ps.Series([None, None, 3, 4, 5], index=[100, 200, 300, 400, 500])
>>> s
100    NaN
200    NaN
300    3.0
400    4.0
500    5.0
dtype: float64

>>> s.first_valid_index()
300

Support for MultiIndex

>>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'],
...                       ['speed', 'weight', 'length']],
...                      [[0, 0, 0, 1, 1, 1, 2, 2, 2],
...                       [0, 1, 2, 0, 1, 2, 0, 1, 2]])
>>> s = ps.Series([None, None, None, None, 250, 1.5, 320, 1, 0.3], index=midx)
>>> s
lama    speed       NaN
        weight      NaN
        length      NaN
cow     speed       NaN
        weight    250.0
        length      1.5
falcon  speed     320.0
        weight      1.0
        length      0.3
dtype: float64

>>> s.first_valid_index()
('cow', 'weight')
def first_valid_index(self) -> Optional[Union[(Scalar, Tuple[(Scalar, ...)])]]:
    "\n        Retrieves the index of the first valid value.\n\n        Returns\n        -------\n        scalar, tuple, or None\n\n        Examples\n        --------\n\n        Support for DataFrame\n\n        >>> psdf = ps.DataFrame({'a': [None, 2, 3, 2],\n        ...                     'b': [None, 2.0, 3.0, 1.0],\n        ...                     'c': [None, 200, 400, 200]},\n        ...                     index=['Q', 'W', 'E', 'R'])\n        >>> psdf\n             a    b      c\n        Q  NaN  NaN    NaN\n        W  2.0  2.0  200.0\n        E  3.0  3.0  400.0\n        R  2.0  1.0  200.0\n\n        >>> psdf.first_valid_index()\n        'W'\n\n        Support for MultiIndex columns\n\n        >>> psdf.columns = pd.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])\n        >>> psdf\n             a    b      c\n             x    y      z\n        Q  NaN  NaN    NaN\n        W  2.0  2.0  200.0\n        E  3.0  3.0  400.0\n        R  2.0  1.0  200.0\n\n        >>> psdf.first_valid_index()\n        'W'\n\n        Support for Series.\n\n        >>> s = ps.Series([None, None, 3, 4, 5], index=[100, 200, 300, 400, 500])\n        >>> s\n        100    NaN\n        200    NaN\n        300    3.0\n        400    4.0\n        500    5.0\n        dtype: float64\n\n        >>> s.first_valid_index()\n        300\n\n        Support for MultiIndex\n\n        >>> midx = pd.MultiIndex([['lama', 'cow', 'falcon'],\n        ...                       ['speed', 'weight', 'length']],\n        ...                      [[0, 0, 0, 1, 1, 1, 2, 2, 2],\n        ...                       [0, 1, 2, 0, 1, 2, 0, 1, 2]])\n        >>> s = ps.Series([None, None, None, None, 250, 1.5, 320, 1, 0.3], index=midx)\n        >>> s\n        lama    speed       NaN\n                weight      NaN\n                length      NaN\n        cow     speed       NaN\n                weight    250.0\n                length      1.5\n        falcon  speed     320.0\n                weight      1.0\n                length      0.3\n        dtype: float64\n\n        >>> s.first_valid_index()\n        ('cow', 'weight')\n        "
    data_spark_columns = self._internal.data_spark_columns
    if (len(data_spark_columns) == 0):
        return None
    cond = reduce((lambda x, y: (x & y)), map((lambda x: x.isNotNull()), data_spark_columns))
    with sql_conf({SPARK_CONF_ARROW_ENABLED: False}):
        first_valid_row = cast(pd.DataFrame, self._internal.spark_frame.filter(cond).select(self._internal.index_spark_columns).limit(1).toPandas())
    if (len(first_valid_row) == 0):
        return None
    first_valid_row = first_valid_row.iloc[0]
    if (len(first_valid_row) == 1):
        return first_valid_row.iloc[0]
    else:
        return tuple(first_valid_row)