__init__.py 659 B

12345678910111213141516171819202122232425
  1. def get_groupby_method_args(name, obj):
  2. """
  3. Get required arguments for a groupby method.
  4. When parametrizing a test over groupby methods (e.g. "sum", "mean", "fillna"),
  5. it is often the case that arguments are required for certain methods.
  6. Parameters
  7. ----------
  8. name: str
  9. Name of the method.
  10. obj: Series or DataFrame
  11. pandas object that is being grouped.
  12. Returns
  13. -------
  14. A tuple of required arguments for the method.
  15. """
  16. if name in ("nth", "fillna", "take"):
  17. return (0,)
  18. if name == "quantile":
  19. return (0.5,)
  20. if name == "corrwith":
  21. return (obj,)
  22. return ()