apache_beam.dataframe.frame_base module¶
- class apache_beam.dataframe.frame_base.UnusableUnpickledDeferredBase(name)[source]¶
Bases:
object
Placeholder object used to break the transitive pickling chain in case a DeferredBase accidentially gets pickled (e.g. as part of globals).
Trying to use this object after unpickling is a bug and will result in an error.
- class apache_beam.dataframe.frame_base.DeferredFrame(expr)[source]¶
Bases:
DeferredBase
- apache_beam.dataframe.frame_base.name_and_func(method: str | Callable) Tuple[str, Callable] [source]¶
For the given method name or method, return the method name and the method itself.
For internal use only. No backwards compatibility guarantees.
- apache_beam.dataframe.frame_base.wont_implement_method(base_type, name, reason=None, explanation=None)[source]¶
Generate a stub method that raises WontImplementError.
Note either reason or explanation must be specified. If both are specified, explanation is ignored.
- Parameters:
base_type – The pandas type of the method that this is trying to replicate.
name – The name of the method that this is aiming to replicate.
reason – If specified, use data from the corresponding entry in
_WONT_IMPLEMENT_REASONS
to generate a helpful exception message and docstring for the method.explanation – If specified, use this string as an explanation for why this operation is not supported when generating an exception message and docstring.
- apache_beam.dataframe.frame_base.not_implemented_method(op, issue='20318', base_type=None)[source]¶
Generate a stub method for
op
that simply raises a NotImplementedError.For internal use only. No backwards compatibility guarantees.
- apache_beam.dataframe.frame_base.maybe_inplace(func)[source]¶
Handles the inplace= kwarg available in many pandas operations.
This decorator produces a new function handles the inplace kwarg. When inplace=False, the new function simply yields the result of func directly.
When inplace=True, the output of func is used to replace this instances expression. The result is that any operations applied to this instance after the inplace operation will refernce the updated expression.
For internal use only. No backwards compatibility guarantees.
- apache_beam.dataframe.frame_base.args_to_kwargs(base_type, removed_method=False, removed_args=None)[source]¶
Convert all args to kwargs before calling the decorated function.
When applied to a function, this decorator creates a new function that always calls the wrapped function with only keyword arguments. It inspects the argspec for the identically-named method on base_type to determine the name to use for arguments that are converted to keyword arguments.
For internal use only. No backwards compatibility guarantees.
- Parameters:
base_type – The pandas type of the method that this is trying to replicate.
removed_method – Whether this method has been removed in the running Pandas version.
removed_args – If not empty, which arguments have been dropped in the running Pandas version.
- apache_beam.dataframe.frame_base.with_docs_from(base_type, name=None, removed_method=False)[source]¶
Decorator that updates the documentation from the wrapped function to duplicate the documentation from the identically-named method in base_type.
Any docstring on the original function will be included in the new function under a “Differences from pandas” heading.
removed_method used in cases where a method has been removed in a later version of Pandas.
- apache_beam.dataframe.frame_base.populate_defaults(base_type, removed_method=False, removed_args=None)[source]¶
Populate default values for keyword arguments in decorated function.
When applied to a function, this decorator creates a new function with default values for all keyword arguments, based on the default values for the identically-named method on base_type.
For internal use only. No backwards compatibility guarantees.
- Parameters:
base_type – The pandas type of the method that this is trying to replicate.
removed_method – Whether this method has been removed in the running Pandas version.
removed_args – If not empty, which arguments have been dropped in the running Pandas version.
- exception apache_beam.dataframe.frame_base.WontImplementError(msg, reason=None)[source]¶
Bases:
NotImplementedError
An subclass of NotImplementedError to raise indicating that implementing the given method is not planned.
Raising this error will also prevent this doctests from being validated when run with the beam dataframe validation doctest runner.