modin.pandas.DataFrame.first_valid_index

DataFrame.first_valid_index() int[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/.tox/docs/lib/python3.9/site-packages/modin/pandas/base.py#L1867-L1871)

Return index for first non-NA value or None, if no non-NA value is found.

Return type:

scalar or None, Tuple of scalars if MultiIndex

Examples

>>> s = pd.Series([None, 3, 4])
>>> s.first_valid_index()
1
>>> s = pd.Series([None, None])
>>> s.first_valid_index()
>>> df = pd.DataFrame({'A': [None, 1, 2, None], 'B': [3, 2, 1, None]}, index=[10, 11, 12, 13])
>>> df
      A    B
10  NaN  3.0
11  1.0  2.0
12  2.0  1.0
13  NaN  NaN
>>> df.first_valid_index()
10
>>> df = pd.DataFrame([5, 6, 7, 8], index=["i", "am", "iron", "man"])
>>> df.first_valid_index()
'i'
Copy
Language: English