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

Method check_funs

pandas/tests/test_nanops.py:390–445  ·  view source on GitHub ↗
(
        self,
        testfunc,
        targfunc,
        skipna,
        allow_complex=True,
        allow_all_nan=True,
        allow_date=True,
        allow_tdelta=True,
        allow_obj=True,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

388 )
389
390 def check_funs(
391 self,
392 testfunc,
393 targfunc,
394 skipna,
395 allow_complex=True,
396 allow_all_nan=True,
397 allow_date=True,
398 allow_tdelta=True,
399 allow_obj=True,
400 **kwargs,
401 ):
402 self.check_fun(testfunc, targfunc, "arr_float", skipna, **kwargs)
403 self.check_fun(testfunc, targfunc, "arr_float_nan", skipna, **kwargs)
404 self.check_fun(testfunc, targfunc, "arr_int", skipna, **kwargs)
405 self.check_fun(testfunc, targfunc, "arr_bool", skipna, **kwargs)
406 objs = [
407 self.arr_float.astype("O"),
408 self.arr_int.astype("O"),
409 self.arr_bool.astype("O"),
410 ]
411
412 if allow_all_nan:
413 self.check_fun(testfunc, targfunc, "arr_nan", skipna, **kwargs)
414
415 if allow_complex:
416 self.check_fun(testfunc, targfunc, "arr_complex", skipna, **kwargs)
417 self.check_fun(testfunc, targfunc, "arr_complex_nan", skipna, **kwargs)
418 if allow_all_nan:
419 self.check_fun(testfunc, targfunc, "arr_nan_nanj", skipna, **kwargs)
420 objs += [self.arr_complex.astype("O")]
421
422 if allow_date:
423 targfunc(self.arr_date)
424 self.check_fun(testfunc, targfunc, "arr_date", skipna, **kwargs)
425 objs += [self.arr_date.astype("O")]
426
427 if allow_tdelta:
428 try:
429 targfunc(self.arr_tdelta)
430 except TypeError:
431 pass
432 else:
433 self.check_fun(testfunc, targfunc, "arr_tdelta", skipna, **kwargs)
434 objs += [self.arr_tdelta.astype("O")]
435
436 if allow_obj:
437 self.arr_obj = np.vstack(objs)
438 # some nanops handle object dtypes better than their numpy
439 # counterparts, so the numpy functions need to be given something
440 # else
441 if allow_obj == "convert":
442 targfunc = partial(
443 self._badobj_wrap, func=targfunc, allow_complex=allow_complex
444 )
445 self.check_fun(testfunc, targfunc, "arr_obj", skipna, **kwargs)
446
447 def _badobj_wrap(self, value, func, allow_complex=True, **kwargs):

Callers 13

test_nan_funcsMethod · 0.95
test_nansumMethod · 0.95
test_nanmeanMethod · 0.95
test_nanmedianMethod · 0.95
test_nanvarMethod · 0.95
test_nanstdMethod · 0.95
test_nansemMethod · 0.95
test_nanargmaxMethod · 0.95
test_nanargminMethod · 0.95
test_nanskewMethod · 0.95
test_nankurtMethod · 0.95

Calls 2

check_funMethod · 0.95
astypeMethod · 0.45

Tested by

no test coverage detected