dtoolkit.accessor.series.invert_or_not#

dtoolkit.accessor.series.invert_or_not(s: Series, /, invert: bool = False) Series[source]#

Invert (~) the Series.

Parameters:
invertbool, default is False

If True, invert the Series.

Returns:
Series(bool)

Examples

>>> import dtoolkit
>>> import pandas as pd
>>> s = pd.Series([True, False, True])
>>> s
0     True
1    False
2     True
dtype: bool
>>> s.invert_or_not()
0     True
1    False
2     True
dtype: bool
>>> s.invert_or_not(invert=True)
0    False
1     True
2    False
dtype: bool