dtoolkit.accessor.series.dropna_index#

dtoolkit.accessor.series.dropna_index(s: Series, /, how: Literal['any', 'all'] = 'any') Series[source]#

Return a new Series with missing index removed.

Parameters:
how{“any”, “all”}, default “any”

If the Index is a MultiIndex, drop the value when “any” or “all” levels are NaN.

Returns:
Series
Raises:
ValueError

If how isn’t “any” or “all”.

Examples

>>> import dtoolkit
>>> import pandas as pd
>>> df = pd.DataFrame({"a": [1, 2], "b": [3, 4]}, index=[None, 0])
>>> df
     a  b
NaN  1  3
0.0  2  4
>>> df.dropna_index()
     a  b
0.0  2  4