You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def_validate_n(self, n):
""" Require that `n` be a nonzero integer. Parameters ---------- n : int Returns ------- nint : int Raises ------ TypeError if `int(n)` raises ValueError if n != int(n) """try:
nint=int(n)
except (ValueError, TypeError):
raiseTypeError('`n` argument must be an integer, ''got {ntype}'.format(ntype=type(n)))
ifn!=nint:
raiseValueError('`n` argument must be an integer, ''got {n}'.format(n=n))
returnnint
It may be that n does not have to be nonzero. Issue #20517 investigates whether n actually has to be nonzero in a case where n is tested again to be nonzero after calling _validate_n:
I assume you aren't facing any issue from an end user perspective but are questioning whether or not this internal method serves a purpose right? If so, do you have a suggestion on what you think it should be doing?
_validate_n
does not test whethern
is nonzero.pandas/pandas/_libs/tslibs/offsets.pyx
Line 355 in 601b8c9
_validate_n
is only used in https://github.com/pandas-dev/pandas/blob/601b8c9c45b3cb06ee4ceaf34456bbfd3f5e5d1d/pandas/tseries/offsets.pyIt may be that
n
does not have to be nonzero. Issue #20517 investigates whethern
actually has to be nonzero in a case wheren
is tested again to be nonzero after calling_validate_n
:pandas/pandas/tseries/offsets.py
Lines 1458 to 1465 in 601b8c9
The text was updated successfully, but these errors were encountered: