MCPcopy
hub / github.com/pandas-dev/pandas / validate_na_arg

Function validate_na_arg

pandas/util/_validators.py:273–297  ·  view source on GitHub ↗

Validate na arguments. Parameters ---------- value : object Value to validate. name : str Name of the argument, used to raise an informative error message. Raises ______ ValueError When ``value`` is determined to be invalid.

(value, name: str)

Source from the content-addressed store, hash-verified

271
272
273def validate_na_arg(value, name: str):
274 """
275 Validate na arguments.
276
277 Parameters
278 ----------
279 value : object
280 Value to validate.
281 name : str
282 Name of the argument, used to raise an informative error message.
283
284 Raises
285 ______
286 ValueError
287 When ``value`` is determined to be invalid.
288 """
289 if (
290 value is lib.no_default
291 or isinstance(value, bool)
292 or value is None
293 or value is NA
294 or (lib.is_float(value) and np.isnan(value))
295 ):
296 return
297 raise ValueError(f"{name} must be None, pd.NA, np.nan, True, or False; got {value}")
298
299
300def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = True):

Callers 4

_str_containsMethod · 0.90
_str_startswithMethod · 0.90
_str_endswithMethod · 0.90
_convert_bool_resultMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected