modin.pandas.Series.last_valid_index

Series.last_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#L2031-L2035)

Return index for last 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.last_valid_index()
2
>>> s = pd.Series([None, None])
>>> s.last_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.last_valid_index()
12
>>> df = pd.DataFrame([5, 6, 7, 8], index=["i", "am", "iron", "man"])
>>> df.last_valid_index()
'man'
Copy
Language: English