From a5886d97e60f817e45ae7143f86f68b32a46b8da Mon Sep 17 00:00:00 2001 From: Arwa Date: Thu, 17 Oct 2024 11:58:14 -0500 Subject: [PATCH 1/4] docs: update docstrings of DataFrame and related files --- bigframes/dataframe.py | 21 +- .../bigframes_vendored/pandas/core/frame.py | 274 ++++++++++-------- .../bigframes_vendored/pandas/core/generic.py | 54 ++-- 3 files changed, 201 insertions(+), 148 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 6ee51380bd..0837d2994a 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -366,6 +366,13 @@ def astype( self, dtype: Union[bigframes.dtypes.DtypeString, bigframes.dtypes.Dtype], ) -> DataFrame: + """ + Casts a dtype to BigQuery DataFrame. + + Returns: + bigframes.pandas.DataFrame: + A BigQuery DataFrame. + """ return self._apply_unary_op(ops.AsTypeOp(to_type=dtype)) def _to_sql_query( @@ -387,7 +394,12 @@ def _to_sql_query( @property def sql(self) -> str: - """Compiles this DataFrame's expression tree to SQL.""" + """Compiles this DataFrame's expression tree to SQL. + + Returns: + str: + string represening the compoiled SQL. + """ include_index = self._has_index and ( self.index.name is not None or len(self.index.names) > 1 ) @@ -399,8 +411,9 @@ def query_job(self) -> Optional[bigquery.QueryJob]: """BigQuery job metadata for the most recent query. Returns: - The most recent `QueryJob - `_. + None or str: + The most recent `QueryJob + `_. """ if self._query_job is None: self._set_internal_query_job(self._compute_dry_run()) @@ -3763,7 +3776,7 @@ def cache(self): Useful if the dataframe will be used multiple times, as this will avoid recomputating the shared intermediate value. Returns: - DataFrame: Self + bigframes.pandas.DataFrame: DataFrame """ return self._cached(force=True) diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index 970883257c..f991883f14 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -89,6 +89,10 @@ def values(self) -> np.ndarray: on another array. na_value (default None): The value to use for missing values. + + Returns: + np.ndarray: + The values of the DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -119,7 +123,7 @@ def T(self) -> DataFrame: [2 rows x 2 columns] Returns: - DataFrame: The transposed DataFrame. + bigframes.pandas.DataFrame: The transposed DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -170,7 +174,7 @@ def transpose(self) -> DataFrame: dtype: object Returns: - DataFrame: The transposed DataFrame. + bigframes.pandas.DataFrame: The transposed DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -216,7 +220,8 @@ def info( shows the counts, and False never shows the counts. Returns: - None: This method prints a summary of a DataFrame and returns None.""" + None: This method prints a summary of a DataFrame and returns None. + """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) def memory_usage(self, index: bool = True): @@ -236,7 +241,7 @@ def memory_usage(self, index: bool = True): the index is the first item in the output. Returns: - Series: A Series whose index is the original column names and whose values is the memory usage of each column in bytes. + bigframes.pandas.Series: A Series whose index is the original column names and whose values is the memory usage of each column in bytes. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -272,7 +277,7 @@ def select_dtypes(self, include=None, exclude=None) -> DataFrame: A selection of dtypes or strings to be excluded. Returns: - DataFrame: The subset of the frame including the dtypes in ``include`` and excluding the dtypes in ``exclude``. + bigframes.pandas.DataFrame: The subset of the frame including the dtypes in ``include`` and excluding the dtypes in ``exclude``. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -304,11 +309,14 @@ def from_dict( dtype (dtype, default None): Data type to force after DataFrame construction, otherwise infer. columns (list, default None): - Column labels to use when ``orient='index'``. Raises a ValueError - if used with ``orient='columns'`` or ``orient='tight'``. + Column labels to use when ``orient='index'``. + + Raises: + ValueError: + If used with ``orient='columns'`` or ``orient='tight'``. Returns: - DataFrame: DataFrame. + bigframes.pandas.DataFrame: DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -349,7 +357,7 @@ def from_records( Number of rows to read if data is an iterator. Returns: - DataFrame: DataFrame. + bigframes.pandas.DataFrame: DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -519,7 +527,7 @@ def to_parquet( If ``False``, they will not be written to the file. Returns: - bytes if no path argument is provided else None + None or bytes: bytes if no path argument is provided else None """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -662,6 +670,10 @@ def to_latex( it is assumed to be aliases for the column names. index (bool, default True): Write row names (index). + + Returns: + str or None: If buf is None, returns the result as a string. Otherwise returns + None. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -952,7 +964,7 @@ def to_markdown( These parameters will be passed to `tabulate `_. Returns: - DataFrame: DataFrame in Markdown-friendly format. + bigframes.pandas.DataFrame: DataFrame in Markdown-friendly format. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -994,6 +1006,11 @@ def to_orc(self, path=None, **kwargs) -> bytes | None: we refer to objects with a write() method, such as a file handle (e.g. via builtin open function). If path is None, a bytes object is returned. + + Returns: + bytes or None: + If buf is None, returns the result as bytes. Otherwise returns + None. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1020,7 +1037,8 @@ def assign(self, **kwargs) -> DataFrame: are simply assigned to the column. Returns: - bigframes.dataframe.DataFrame: A new DataFrame with the new columns + bigframes.pandas.DataFrame: + A new DataFrame with the new columns in addition to all the existing columns. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1054,7 +1072,7 @@ def reindex( Axis to target. Can be either the axis name ('index', 'columns') or number (0, 1). Returns: - DataFrame: DataFrame with changed index. + bigframes.pandas.DataFrame: DataFrame with changed index. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1071,16 +1089,14 @@ def reindex_like(self, other): of this object. Returns: - Series or DataFrame: Same type as caller, but with changed indices on each axis. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + Same type as caller, but with changed indices on each axis. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) def insert(self, loc, column, value, allow_duplicates=False): """Insert column into DataFrame at specified location. - Raises a ValueError if `column` is already contained in the DataFrame, - unless `allow_duplicates` is set to True. - **Examples:** >>> import bigframes.pandas as bpd @@ -1117,6 +1133,11 @@ def insert(self, loc, column, value, allow_duplicates=False): Content of the inserted column. allow_duplicates (bool, default False): Allow duplicate column labels to be created. + + Raises: + ValueError: + If `column` is already contained in the DataFrame, + unless `allow_duplicates` is set to True. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1233,7 +1254,7 @@ def drop( level: For MultiIndex, level from which the labels will be removed. Returns: - bigframes.dataframe.DataFrame: DataFrame without the removed column labels. + bigframes.pandas.DataFrame: DataFrame without the removed column labels. Raises: KeyError: If any of the labels is not found in the selected axis. @@ -1266,7 +1287,7 @@ def align( Align on index (0), columns (1), or both (None). Returns: - tuple of (DataFrame, type of other): Aligned objects. + tuple of (bigframes.pandas.DataFrame, type of other): Aligned objects. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1309,7 +1330,7 @@ def rename( Dict-like from old column labels to new column labels. Returns: - bigframes.dataframe.DataFrame: DataFrame with the renamed axis labels. + bigframes.pandas.DataFrame: DataFrame with the renamed axis labels. Raises: KeyError: If any of the labels is not found. @@ -1328,7 +1349,7 @@ def rename_axis(self, mapper: Optional[str], **kwargs) -> DataFrame: Value to set the axis name attribute. Returns: - bigframes.dataframe.DataFrame: DataFrame with the new index name + bigframes.pandas.DataFrame: DataFrame with the new index name """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1392,7 +1413,7 @@ def set_index( Delete columns to be used as the new index. Returns: - DataFrame: Changed row labels. + bigframes.pandas.DataFrame: Changed row labels. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1410,7 +1431,7 @@ def reorder_levels( Where to reorder levels. Returns: - DataFrame: DataFrame of rearranged index. + bigframes.pandas.DataFrame: DataFrame of rearranged index. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1428,7 +1449,7 @@ def swaplevel(self, i, j, axis: str | int = 0) -> DataFrame: 'columns' for column-wise. Returns: - DataFrame: DataFrame with levels swapped in MultiIndex. + bigframes.pandas.DataFrame: DataFrame with levels swapped in MultiIndex. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1447,7 +1468,7 @@ def droplevel(self, level, axis: str | int = 0): * 0 or 'index': remove level(s) in column. * 1 or 'columns': remove level(s) in row. Returns: - DataFrame: DataFrame with requested index / column level(s) removed. + bigframes.pandas.DataFrame: DataFrame with requested index / column level(s) removed. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1553,7 +1574,7 @@ class name speed max the index to the default integer index. Returns: - bigframes.dataframe.DataFrame: DataFrame with the new index. + bigframes.pandas.DataFrame: DataFrame with the new index. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1580,7 +1601,7 @@ def drop_duplicates( - ``False`` : Drop all duplicates. Returns: - bigframes.dataframe.DataFrame: DataFrame with duplicates removed + bigframes.pandas.DataFrame: DataFrame with duplicates removed """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1602,7 +1623,7 @@ def duplicated(self, subset=None, keep="first"): - False : Mark all duplicates as ``True``. Returns: - bigframes.series.Series: Boolean series for each duplicated rows. + bigframes.pandas.Series: Boolean series for each duplicated rows. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1697,7 +1718,7 @@ def dropna( Returns: - bigframes.dataframe.DataFrame: DataFrame with NA entries dropped from it. + bigframes.pandas.DataFrame: DataFrame with NA entries dropped from it. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1745,7 +1766,7 @@ def isin(self, values): the column names, which must match. Returns: - DataFrame: DataFrame of booleans showing whether each element + bigframes.pandas.DataFrame: DataFrame of booleans showing whether each element in the DataFrame is contained in values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1769,7 +1790,7 @@ def keys(self): Index(['A', 'B'], dtype='object') Returns: - Index: Info axis. + pandas.Index: Info axis. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1777,9 +1798,6 @@ def iterrows(self): """ Iterate over DataFrame rows as (index, Series) pairs. - Yields: - a tuple (index, data) where data contains row values as a Series - **Examples:** >>> import bigframes.pandas as bpd @@ -1795,6 +1813,10 @@ def iterrows(self): A 1 B 4 Name: 0, dtype: object + + Yields: + A tuple of (index, data): + A tuple where data contains row values as a Series """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1821,7 +1843,7 @@ def itertuples(self, index: bool = True, name: str | None = "Pandas"): tuples. Returns: - iterator: + Iterator: An object to iterate over namedtuples for each row in the DataFrame with the first field possibly being the index and following fields being the column values. @@ -1976,7 +1998,7 @@ def sort_values( if `first`; `last` puts NaNs at the end. Returns: - DataFrame: DataFrame with sorted values. + bigframes.pandas.DataFrame: DataFrame with sorted values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1986,7 +2008,7 @@ def sort_index( """Sort object by labels (along an axis). Returns: - DataFrame: The original DataFrame sorted by the labels. + bigframes.pandas.DataFrame: The original DataFrame sorted by the labels. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2035,7 +2057,7 @@ def eq(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). Returns: - DataFrame: Result of the comparison. + bigframes.pandas.DataFrame: Result of the comparison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2068,7 +2090,7 @@ def __eq__(self, other): Object to be compared to the DataFrame for equality. Returns: - DataFrame: The result of comparing `other` to DataFrame. + bigframes.pandas.DataFrame: The result of comparing `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2092,7 +2114,7 @@ def __invert__(self) -> DataFrame: [3 rows x 2 columns] Returns: - DataFrame: The result of inverting elements in the input. + bigframes.pandas.DataFrame: The result of inverting elements in the input. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2137,7 +2159,7 @@ def ne(self, other, axis: str | int = "columns") -> DataFrame: Whether to compare by the index (0 or 'index') or columns (1 or 'columns'). Returns: - DataFrame: Result of the comparison. + bigframes.pandas.DataFrame: Result of the comparison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2170,7 +2192,7 @@ def __ne__(self, other): Object to be compared to the DataFrame for inequality. Returns: - DataFrame: The result of comparing `other` to DataFrame. + bigframes.pandas.DataFrame: The result of comparing `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2220,7 +2242,7 @@ def le(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). Returns: - DataFrame: DataFrame of bool. The result of the comparison. + bigframes.pandas.DataFrame: DataFrame of bool. The result of the comparison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2253,7 +2275,7 @@ def __le__(self, other): Object to be compared to the DataFrame. Returns: - DataFrame: The result of comparing `other` to DataFrame. + bigframes.pandas.DataFrame: The result of comparing `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2303,7 +2325,7 @@ def lt(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). Returns: - DataFrame: DataFrame of bool. The result of the comparison. + bigframes.pandas.DataFrame: DataFrame of bool. The result of the comparison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2336,7 +2358,7 @@ def __lt__(self, other): Object to be compared to the DataFrame. Returns: - DataFrame: The result of comparing `other` to DataFrame. + bigframes.pandas.DataFrame: The result of comparing `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2386,7 +2408,7 @@ def ge(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). Returns: - DataFrame: DataFrame of bool. The result of the comparison. + bigframes.pandas.DataFrame: DataFrame of bool. The result of the comparison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2419,7 +2441,7 @@ def __ge__(self, other): Object to be compared to the DataFrame. Returns: - DataFrame: The result of comparing `other` to DataFrame. + bigframes.pandas.DataFrame: The result of comparing `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2467,7 +2489,7 @@ def gt(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). Returns: - DataFrame: DataFrame of bool: The result of the comparison. + bigframes.pandas.DataFrame: DataFrame of bool: The result of the comparison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2500,7 +2522,7 @@ def __gt__(self, other): Object to be compared to the DataFrame. Returns: - DataFrame: The result of comparing `other` to DataFrame. + bigframes.pandas.DataFrame: The result of comparing `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2549,7 +2571,7 @@ def add(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2619,7 +2641,7 @@ def __add__(self, other) -> DataFrame: Object to be added to the DataFrame. Returns: - DataFrame: The result of adding `other` to DataFrame. + bigframes.pandas.DataFrame: The result of adding `other` to DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2668,7 +2690,7 @@ def radd(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2717,7 +2739,7 @@ def sub(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2760,7 +2782,7 @@ def __sub__(self, other): Object to subtract from the DataFrame. Returns: - DataFrame: The result of the subtraction. + bigframes.pandas.DataFrame: The result of the subtraction. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2806,7 +2828,7 @@ def rsub(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2821,7 +2843,7 @@ def __rsub__(self, other): Object to subtract the DataFrame from. Returns: - DataFrame: The result of the subtraction. + bigframes.pandas.DataFrame: The result of the subtraction. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2870,7 +2892,7 @@ def mul(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2913,7 +2935,7 @@ def __mul__(self, other): Object to multiply with the DataFrame. Returns: - DataFrame: The result of the multiplication. + bigframes.pandas.DataFrame: The result of the multiplication. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -2962,7 +2984,7 @@ def rmul(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3005,7 +3027,7 @@ def __rmul__(self, other): Object to multiply the DataFrame with. Returns: - DataFrame: The result of the multiplication. + bigframes.pandas.DataFrame: The result of the multiplication. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3054,7 +3076,7 @@ def truediv(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3097,7 +3119,7 @@ def __truediv__(self, other): Object to divide the DataFrame by. Returns: - DataFrame: The result of the division. + bigframes.pandas.DataFrame: The result of the division. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3143,7 +3165,7 @@ def rtruediv(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3158,7 +3180,7 @@ def __rtruediv__(self, other): Object to divide by the DataFrame. Returns: - DataFrame: The result of the division. + bigframes.pandas.DataFrame: The result of the division. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3207,7 +3229,7 @@ def floordiv(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3250,7 +3272,7 @@ def __floordiv__(self, other): Object to divide the DataFrame by. Returns: - DataFrame: The result of the integer divison. + bigframes.pandas.DataFrame: The result of the integer divison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3296,7 +3318,7 @@ def rfloordiv(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3311,7 +3333,7 @@ def __rfloordiv__(self, other): Object to divide by the DataFrame. Returns: - DataFrame: The result of the integer divison. + bigframes.pandas.DataFrame: The result of the integer divison. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3360,7 +3382,7 @@ def mod(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3403,7 +3425,7 @@ def __mod__(self, other): Object to modulo the DataFrame by. Returns: - DataFrame: The result of the modulo. + bigframes.pandas.DataFrame: The result of the modulo. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3449,7 +3471,7 @@ def rmod(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3464,7 +3486,7 @@ def __rmod__(self, other): Object to modulo by the DataFrame. Returns: - DataFrame: The result of the modulo. + bigframes.pandas.DataFrame: The result of the modulo. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3514,7 +3536,7 @@ def pow(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3558,7 +3580,7 @@ def __pow__(self, other): Object to exponentiate the DataFrame with. Returns: - DataFrame: The result of the exponentiation. + bigframes.pandas.DataFrame: The result of the exponentiation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3605,7 +3627,7 @@ def rpow(self, other, axis: str | int = "columns") -> DataFrame: (1 or 'columns'). For Series input, axis to match Series index on. Returns: - DataFrame: DataFrame result of the arithmetic operation. + bigframes.pandas.DataFrame: DataFrame result of the arithmetic operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3699,7 +3721,7 @@ def combine( overwritten with NaNs. Returns: - DataFrame: Combination of the provided DataFrames. + bigframes.pandas.DataFrame: Combination of the provided DataFrames. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3734,7 +3756,8 @@ def combine_first(self, other) -> DataFrame: Provided DataFrame to use to fill null values. Returns: - DataFrame: The result of combining the provided DataFrame with the other object. + bigframes.pandas.DataFrame: + The result of combining the provided DataFrame with the other object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3784,7 +3807,7 @@ def explode( If True, the resulting index will be labeled 0, 1, …, n - 1. Returns: - bigframes.series.DataFrame: Exploded lists to rows of the subset columns; + bigframes.pandas.DataFrame: Exploded lists to rows of the subset columns; index will be duplicated for these rows. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3819,7 +3842,7 @@ def corr(self, method, min_periods, numeric_only) -> DataFrame: Include only float, int, boolean, decimal data. Returns: - DataFrame: Correlation matrix. + bigframes.pandas.DataFrame: Correlation matrix. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -3848,7 +3871,7 @@ def cov(self, *, numeric_only) -> DataFrame: Include only float, int, boolean, decimal data. Returns: - DataFrame: The covariance matrix of the series of the DataFrame. + bigframes.pandas.DataFrame: The covariance matrix of the series of the DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4080,7 +4103,7 @@ def map(self, func, na_action: Optional[str] = None) -> DataFrame: values, without passing them to func. Returns: - bigframes.dataframe.DataFrame: Transformed DataFrame. + bigframes.pandas.DataFrame: Transformed DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4180,7 +4203,7 @@ def join(self, other, *, on: Optional[str] = None, how: str) -> DataFrame: the order of the left keys. Returns: - bigframes.dataframe.DataFrame: A dataframe containing columns from both the caller and `other`. + bigframes.pandas.DataFrame: A dataframe containing columns from both the caller and `other`. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4325,7 +4348,7 @@ def merge( no suffix. At least one of the values must not be None. Returns: - bigframes.dataframe.DataFrame: A DataFrame of the two merged objects. + bigframes.pandas.DataFrame: A DataFrame of the two merged objects. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4438,7 +4461,8 @@ def apply(self, func, *, axis=0, args=(), **kwargs): `func`. Returns: - pandas.Series or bigframes.DataFrame: Result of applying ``func`` along the given axis of the DataFrame. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + Result of applying ``func`` along the given axis of the DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4488,7 +4512,7 @@ def any(self, *, axis=0, bool_only: bool = False): Include only boolean columns. Returns: - bigframes.series.Series: Series indicating if any element is True per column. + bigframes.pandas.Series: Series indicating if any element is True per column. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4535,7 +4559,7 @@ def all(self, axis=0, *, bool_only: bool = False): Include only boolean columns. Returns: - bigframes.series.Series: Series indicating if all elements are True per column. + bigframes.pandas.Series: Series indicating if all elements are True per column. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4580,7 +4604,7 @@ def prod(self, axis=0, *, numeric_only: bool = False): Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series with the product of the values. + bigframes.pandas.Series: Series with the product of the values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4625,7 +4649,7 @@ def min(self, axis=0, *, numeric_only: bool = False): Default False. Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series with the minimum of the values. + bigframes.pandas.Series: Series with the minimum of the values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4670,7 +4694,7 @@ def max(self, axis=0, *, numeric_only: bool = False): Default False. Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series after the maximum of values. + bigframes.pandas.Series: Series after the maximum of values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4714,7 +4738,7 @@ def sum(self, axis=0, *, numeric_only: bool = False): Default False. Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series with the sum of values. + bigframes.pandas.Series: Series with the sum of values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4756,7 +4780,7 @@ def mean(self, axis=0, *, numeric_only: bool = False): Default False. Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series with the mean of values. + bigframes.pandas.Series: Series with the mean of values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4791,7 +4815,7 @@ def median(self, *, numeric_only: bool = False, exact: bool = True): one. Returns: - bigframes.series.Series: Series with the median of values. + bigframes.pandas.Series: Series with the median of values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4825,7 +4849,7 @@ def quantile( Include only `float`, `int` or `boolean` data. Returns: - Series or DataFrame: + bigframes.pandas.DataFrame or bigframes.pandas.Series: If ``q`` is an array, a DataFrame will be returned where the index is ``q``, the columns are the columns of self, and the values are the quantiles. @@ -4875,7 +4899,7 @@ def var(self, axis=0, *, numeric_only: bool = False): Default False. Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series with unbiased variance over requested axis. + bigframes.pandas.Series: Series with unbiased variance over requested axis. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4915,7 +4939,7 @@ def skew(self, *, numeric_only: bool = False): Include only float, int, boolean columns. Returns: - Series: Series. + bigframes.pandas.Series: Series. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4956,7 +4980,7 @@ def kurt(self, *, numeric_only: bool = False): Include only float, int, boolean columns. Returns: - Series: Series. + bigframes.pandas.Series: Series. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -4996,7 +5020,7 @@ def std(self, *, numeric_only: bool = False): Default False. Include only float, int, boolean columns. Returns: - bigframes.series.Series: Series with sample standard deviation. + bigframes.pandas.Series: Series with sample standard deviation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5038,7 +5062,7 @@ def count(self, *, numeric_only: bool = False): Include only `float`, `int` or `boolean` data. Returns: - bigframes.series.Series: For each column/row the number of + bigframes.pandas.Series: For each column/row the number of non-NA/null entries. If `level` is specified returns a `DataFrame`. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5126,7 +5150,7 @@ def nlargest(self, n: int, columns, keep: str = "first"): selecting more than `n` items. Returns: - DataFrame: The first `n` rows ordered by the given columns in descending order. + bigframes.pandas.DataFrame: The first `n` rows ordered by the given columns in descending order. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5214,7 +5238,7 @@ def nsmallest(self, n: int, columns, keep: str = "first"): selecting more than `n` items. Returns: - DataFrame: The first `n` rows ordered by the given columns in ascending order. + bigframes.pandas.DataFrame: The first `n` rows ordered by the given columns in ascending order. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5244,7 +5268,7 @@ def idxmin(self): dtype: Int64 Returns: - Series: Indexes of minima along the columns. + bigframes.pandas.Series: Indexes of minima along the columns. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5274,7 +5298,7 @@ def idxmax(self): dtype: Int64 Returns: - Series: Indexes of maxima along the columns. + bigframes.pandas.Series: Indexes of maxima along the columns. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5359,7 +5383,7 @@ def melt(self, id_vars, value_vars, var_name, value_name): Name to use for the 'value' column. Returns: - DataFrame: Unpivoted DataFrame. + bigframes.pandas.DataFrame: Unpivoted DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5387,7 +5411,7 @@ def nunique(self): dtype: Int64 Returns: - bigframes.series.Series: Series with number of distinct elements. + bigframes.pandas.Series: Series with number of distinct elements. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5419,7 +5443,7 @@ def cummin(self) -> DataFrame: [3 rows x 2 columns] Returns: - bigframes.dataframe.DataFrame: Return cumulative minimum of DataFrame. + bigframes.pandas.DataFrame: Return cumulative minimum of DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5451,7 +5475,7 @@ def cummax(self) -> DataFrame: [3 rows x 2 columns] Returns: - bigframes.dataframe.DataFrame: Return cumulative maximum of DataFrame. + bigframes.pandas.DataFrame: Return cumulative maximum of DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5483,7 +5507,7 @@ def cumsum(self) -> DataFrame: [3 rows x 2 columns] Returns: - bigframes.dataframe.DataFrame: Return cumulative sum of DataFrame. + bigframes.pandas.DataFrame: Return cumulative sum of DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5515,7 +5539,7 @@ def cumprod(self) -> DataFrame: [3 rows x 2 columns] Returns: - bigframes.dataframe.DataFrame: Return cumulative product of DataFrame. + bigframes.pandas.DataFrame: Return cumulative product of DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5568,7 +5592,7 @@ def diff( values. Returns: - bigframes.dataframe.DataFrame: First differences of the Series. + bigframes.pandas.DataFrame: First differences of the Series. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5613,7 +5637,7 @@ def agg(self, func): function names, e.g. ``['sum', 'mean']``. Returns: - DataFrame or bigframes.series.Series: Aggregated results. + bigframes.pandas.DataFrame or bigframes.pandas.Series: Aggregated results. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5665,7 +5689,7 @@ def describe(self): [8 rows x 2 columns] Returns: - bigframes.dataframe.DataFrame: Summary statistics of the Series or Dataframe provided. + bigframes.pandas.DataFrame: Summary statistics of the Series or Dataframe provided. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5747,7 +5771,7 @@ def pivot(self, *, columns, index=None, values=None): have hierarchically indexed columns. Returns: - DataFrame: Returns reshaped DataFrame. + bigframes.pandas.DataFrame: Returns reshaped DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5829,7 +5853,7 @@ def pivot_table(self, values=None, index=None, columns=None, aggfunc="mean"): Aggregation function name to compute summary statistics (e.g., 'sum', 'mean'). Returns: - DataFrame: An Excel style pivot table. + bigframes.pandas.DataFrame: An Excel style pivot table. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5876,7 +5900,7 @@ def stack(self, level=-1): Level(s) to stack from the column axis onto the index axis. Returns: - DataFrame or Series: Stacked dataframe or series. + bigframes.pandas.DataFrame or bigframes.pandas.Series: Stacked dataframe or series. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -5915,7 +5939,7 @@ def unstack(self, level=-1): Level(s) of index to unstack, can pass level name. Returns: - DataFrame or Series: DataFrame or Series. + bigframes.pandas.DataFrame or bigframes.pandas.Series: DataFrame or Series. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -6101,7 +6125,7 @@ def value_counts( Don’t include counts of rows that contain NA values. Returns: - Series: Series containing counts of unique rows in the DataFrame + bigframes.pandas.Series: Series containing counts of unique rows in the DataFrame """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -6181,7 +6205,7 @@ def eval(self, expr: str) -> DataFrame: The expression string to evaluate. Returns: - DataFrame + bigframes.pandas.DataFrame: DataFrame result after the operation. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -6255,7 +6279,8 @@ def query(self, expr: str) -> DataFrame | None: to sum it with ``b``, your query should be ```a a` + b``. Returns: - DataFrame + None or bigframes.pandas.DataFrame: + DataFrame result after the query operation, otherwise None. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -6303,7 +6328,7 @@ def interpolate(self, method: str = "linear"): 'nearest', 'zero', 'slinear': Emulates `scipy.interpolate.interp1d` Returns: - DataFrame: + bigframes.pandas.DataFrame: Returns the same object type as the caller, interpolated at some or all ``NaN`` values """ @@ -6372,7 +6397,7 @@ def fillna(self, value): be a list. Returns: - DataFrame: Object with missing values filled + bigframes.pandas.DataFrame: Object with missing values filled """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -6460,7 +6485,8 @@ def replace( string. Returns: - Series/DataFrame: Object after replacement. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + Object after replacement. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -6643,7 +6669,7 @@ def dot(self, other): The other object to compute the matrix product with. Returns: - Series or DataFrame: + bigframes.pandas.DataFrame or bigframes.pandas.Series: If `other` is a Series, return the matrix product between self and other as a Series. If other is a DataFrame, return the matrix product of self and other in a DataFrame. @@ -6837,7 +6863,7 @@ def __getitem__(self, key): column labels Returns: - Series or Value: Value(s) at the requested index(es). + bigframes.pandas.Series or Value: Value(s) at the requested index(es). """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index 6734fb6aa9..344cf4a739 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -57,7 +57,8 @@ def __iter__(self) -> Iterator: Iterate over column axis for DataFrame, or values for Series. Returns: - iterator + Iterator: + Iterator of DataFrame or Series values. **Examples:** @@ -91,8 +92,8 @@ def abs(self): This function only applies to elements that are all numeric. Returns: - Series/DataFrame containing the absolute value of each element. - Returns a Series/DataFrame containing the absolute value of each element. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + A Series or DataFrame containing the absolute value of each element. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -370,7 +371,8 @@ def get(self, key, default=None): key: object Returns: - same type as items contained in object + bigframes.pandas.DataFrame or bigframes.pandas.Series: + same type as items contained in object """ try: return self[key] @@ -391,7 +393,8 @@ def add_prefix(self, prefix: str, axis: int | str | None = None): to add prefix on. Returns: - New Series or DataFrame with updated labels. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + New Series or DataFrame with updated labels. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -409,7 +412,8 @@ def add_suffix(self, suffix: str, axis: int | str | None = None): to add suffix on Returns: - New Series or DataFrame with updated labels. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + New Series or DataFrame with updated labels. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -486,7 +490,8 @@ def head(self, n: int = 5): Default 5. Number of rows to select. Returns: - same type as caller: The first ``n`` rows of the caller object. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + The first ``n`` rows of the caller object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -507,7 +512,8 @@ def tail(self, n: int = 5): Number of rows to select. Returns: - The last `n` rows of the caller object. + bigframes.pandas.DataFrame: + The last `n` rows of the caller object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -584,8 +590,9 @@ def sample( - 'False': The sample will retain the original object's order. Returns: - A new object of same type as caller containing `n` items randomly - sampled from the caller object. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + A new object of same type as caller containing `n` items randomly + sampled from the caller object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -613,7 +620,8 @@ def dtypes(self): dtype: object Returns: - A *pandas* Series with the data type of each column. + pandas.Series: + A *pandas* Series with the data type of each column. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -686,7 +694,8 @@ def copy(self): [2 rows x 2 columns] Returns: - Object type matches caller. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + Object type matches caller. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -749,7 +758,8 @@ def ffill(self, *, limit: Optional[int] = None): Returns: - Series/DataFrame or None: Object with missing values filled. + bigframes.pandas.DataFrame or bigframes.pandas.Series or None: + Object with missing values filled. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -766,7 +776,8 @@ def bfill(self, *, limit: Optional[int] = None): filled. Must be greater than 0 if not None. Returns: - Series/DataFrame or None: Object with missing values filled. + bigframes.pandas.DataFrame or bigframes.pandas.Series or None: + Object with missing values filled. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -844,8 +855,9 @@ def isna(self) -> NDFrame: dtype: boolean Returns: - Mask of bool values for each element that indicates whether an - element is an NA value. + NDFrame: + Mask of bool values for each element that indicates whether an + element is an NA value. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -893,7 +905,7 @@ def filter( DataFrame. For `Series` this parameter is unused and defaults to `None`. Returns: - same type as input object + NDFrame: same type as input object """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -934,7 +946,7 @@ def pct_change(self, periods: int = 1): Periods to shift for forming percent change. Returns: - Series or DataFrame: The same type as the calling object. + bigframes.pandas.DataFrame or bigframes.pandas.Series: The same type as the calling object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -972,7 +984,8 @@ def rank( Whether or not the elements should be ranked in ascending order. Returns: - same type as caller: Return a Series or DataFrame with data ranks as values. + bigframes.pandas.DataFrame or bigframes.pandas.Series: + Return a Series or DataFrame with data ranks as values. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1126,7 +1139,8 @@ def pipe( A dictionary of keyword arguments passed into ``func``. Returns: - same type as caller + T: + Object of same type as caller """ return common.pipe(self, func, *args, **kwargs) From ef05c89ed8f1af2c7812e19748cf330c1919404b Mon Sep 17 00:00:00 2001 From: Arwa Date: Mon, 21 Oct 2024 10:49:53 -0500 Subject: [PATCH 2/4] Fix doctrings to resolve comments --- bigframes/dataframe.py | 7 ------- third_party/bigframes_vendored/pandas/core/frame.py | 2 +- third_party/bigframes_vendored/pandas/core/generic.py | 5 +++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 0837d2994a..20ffc88b85 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -366,13 +366,6 @@ def astype( self, dtype: Union[bigframes.dtypes.DtypeString, bigframes.dtypes.Dtype], ) -> DataFrame: - """ - Casts a dtype to BigQuery DataFrame. - - Returns: - bigframes.pandas.DataFrame: - A BigQuery DataFrame. - """ return self._apply_unary_op(ops.AsTypeOp(to_type=dtype)) def _to_sql_query( diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index f991883f14..8fc55bf0d7 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -91,7 +91,7 @@ def values(self) -> np.ndarray: The value to use for missing values. Returns: - np.ndarray: + numpy.ndarray: The values of the DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index 344cf4a739..b2609e20dc 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -182,7 +182,8 @@ def astype(self, dtype): ``pd.ArrowDtype(pa.timestamp("us", tz="UTC"))``. Returns: - same type as caller + bigframes.pandas.DataFrame: + A BigQuery DataFrame. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1139,7 +1140,7 @@ def pipe( A dictionary of keyword arguments passed into ``func``. Returns: - T: + bigframes.pandas.DataFrame or bigframes.pandas.Series: Object of same type as caller """ return common.pipe(self, func, *args, **kwargs) From 35876a352e8fc448f043928abd4da0fc5ac82e5e Mon Sep 17 00:00:00 2001 From: Arwa Date: Wed, 23 Oct 2024 10:28:00 -0500 Subject: [PATCH 3/4] Fix return types --- bigframes/dataframe.py | 2 +- third_party/bigframes_vendored/pandas/core/frame.py | 3 ++- third_party/bigframes_vendored/pandas/core/generic.py | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 20ffc88b85..f6e06ce468 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -391,7 +391,7 @@ def sql(self) -> str: Returns: str: - string represening the compoiled SQL. + string representing the compiled SQL. """ include_index = self._has_index and ( self.index.name is not None or len(self.index.names) > 1 diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index 8fc55bf0d7..ffab1a0486 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -964,7 +964,8 @@ def to_markdown( These parameters will be passed to `tabulate `_. Returns: - bigframes.pandas.DataFrame: DataFrame in Markdown-friendly format. + str: + DataFrame in Markdown-friendly format. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index b2609e20dc..427ac3c9fc 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -856,7 +856,7 @@ def isna(self) -> NDFrame: dtype: boolean Returns: - NDFrame: + bigframes.pandas.DataFrame or bigframes.pandas.Series: Mask of bool values for each element that indicates whether an element is an NA value. """ @@ -906,7 +906,8 @@ def filter( DataFrame. For `Series` this parameter is unused and defaults to `None`. Returns: - NDFrame: same type as input object + bigframes.pandas.DataFrame or bigframes.pandas.Series: + Same type as input object. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) From e7c9ea0bdb17d7f40c14d0e23e6f2acf00ecca46 Mon Sep 17 00:00:00 2001 From: Arwa Date: Wed, 23 Oct 2024 15:52:36 -0500 Subject: [PATCH 4/4] Fixed return types --- bigframes/dataframe.py | 4 ++-- .../bigframes_vendored/pandas/core/frame.py | 15 ++++++++++----- .../bigframes_vendored/pandas/core/generic.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index f6e06ce468..f803b66ab6 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -379,7 +379,7 @@ def _to_sql_query( whether to include index columns. Returns: - a tuple of (sql_string, index_column_id_list, index_column_label_list). + Tuple[sql_string, index_column_id_list, index_column_label_list]: If include_index is set to False, index_column_id_list and index_column_label_list return empty lists. """ @@ -404,7 +404,7 @@ def query_job(self) -> Optional[bigquery.QueryJob]: """BigQuery job metadata for the most recent query. Returns: - None or str: + None or google.cloud.bigquery.QueryJob: The most recent `QueryJob `_. """ diff --git a/third_party/bigframes_vendored/pandas/core/frame.py b/third_party/bigframes_vendored/pandas/core/frame.py index ffab1a0486..a6c11ed1b9 100644 --- a/third_party/bigframes_vendored/pandas/core/frame.py +++ b/third_party/bigframes_vendored/pandas/core/frame.py @@ -45,6 +45,10 @@ def shape(self) -> tuple[int, int]: ... 'col2': [4, 5, 6]}) >>> df.shape (3, 2) + + Returns: + Tuple[int, int]: + Tuple of array dimensions. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1288,7 +1292,8 @@ def align( Align on index (0), columns (1), or both (None). Returns: - tuple of (bigframes.pandas.DataFrame, type of other): Aligned objects. + Tuple[bigframes.pandas.DataFrame or bigframes.pandas.Series, type of other]: + Aligned objects. """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1815,8 +1820,8 @@ def iterrows(self): B 4 Name: 0, dtype: object - Yields: - A tuple of (index, data): + Returns: + Iterable[Tuple]: A tuple where data contains row values as a Series """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) @@ -1844,7 +1849,7 @@ def itertuples(self, index: bool = True, name: str | None = "Pandas"): tuples. Returns: - Iterator: + Iterable[Tuple]: An object to iterate over namedtuples for each row in the DataFrame with the first field possibly being the index and following fields being the column values. @@ -6864,7 +6869,7 @@ def __getitem__(self, key): column labels Returns: - bigframes.pandas.Series or Value: Value(s) at the requested index(es). + bigframes.pandas.Series or Any: Value(s) at the requested index(es). """ raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE) diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index 427ac3c9fc..0ac527e2ff 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -372,7 +372,7 @@ def get(self, key, default=None): key: object Returns: - bigframes.pandas.DataFrame or bigframes.pandas.Series: + Any: same type as items contained in object """ try: