diff --git a/ci/code_checks.sh b/ci/code_checks.sh index c4e43b88a0097..c994975c1a08e 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -623,18 +623,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.DataFrame.mean\ pandas.DataFrame.median\ pandas.DataFrame.min\ - pandas.DataFrame.pop\ pandas.DataFrame.prod\ pandas.DataFrame.product\ - pandas.DataFrame.reindex\ - pandas.DataFrame.reorder_levels\ pandas.DataFrame.sem\ pandas.DataFrame.skew\ pandas.DataFrame.std\ pandas.DataFrame.sum\ - pandas.DataFrame.swapaxes\ - pandas.DataFrame.to_numpy\ - pandas.DataFrame.to_orc\ pandas.DataFrame.to_parquet\ pandas.DataFrame.unstack\ pandas.DataFrame.value_counts\ diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 88fa1148c0dfc..2a6daf4bab937 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1883,6 +1883,7 @@ def to_numpy( Returns ------- numpy.ndarray + The NumPy array representing the values in the DataFrame. See Also -------- @@ -2930,7 +2931,7 @@ def to_orc( engine_kwargs: dict[str, Any] | None = None, ) -> bytes | None: """ - Write a DataFrame to the ORC format. + Write a DataFrame to the Optimized Row Columnar (ORC) format. .. versionadded:: 1.5.0 @@ -2957,7 +2958,8 @@ def to_orc( Returns ------- - bytes if no path argument is provided else None + bytes if no ``path`` argument is provided else None + Bytes object with DataFrame data if ``path`` is not specified else None. Raises ------ @@ -2977,6 +2979,8 @@ def to_orc( Notes ----- + * Find more information on ORC + `here `__. * Before using this function you should read the :ref:`user guide about ORC ` and :ref:`install optional dependencies `. * This function requires `pyarrow `_ @@ -5473,7 +5477,7 @@ def rename( def pop(self, item: Hashable) -> Series: """ - Return item and drop from frame. Raise KeyError if not found. + Return item and drop it from DataFrame. Raise KeyError if not found. Parameters ---------- @@ -5483,6 +5487,7 @@ def pop(self, item: Hashable) -> Series: Returns ------- Series + Series representing the item that is dropped. Examples -------- @@ -7612,7 +7617,9 @@ def swaplevel(self, i: Axis = -2, j: Axis = -1, axis: Axis = 0) -> DataFrame: def reorder_levels(self, order: Sequence[int | str], axis: Axis = 0) -> DataFrame: """ - Rearrange index levels using input order. May not drop or duplicate levels. + Rearrange index or column levels using input ``order``. + + May not drop or duplicate levels. Parameters ---------- @@ -7625,6 +7632,7 @@ def reorder_levels(self, order: Sequence[int | str], axis: Axis = 0) -> DataFram Returns ------- DataFrame + DataFrame with indices or columns with reordered levels. Examples -------- diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 5119e799e6de1..bf10a36ea7dda 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -583,7 +583,7 @@ def _get_index_resolvers(self) -> dict[Hashable, Series | MultiIndex]: @final def _get_cleaned_column_resolvers(self) -> dict[Hashable, Series]: """ - Return the special character free column resolvers of a dataframe. + Return the special character free column resolvers of a DataFrame. Column names with special characters are 'cleaned up' so that they can be referred to by backtick quoting. @@ -5077,7 +5077,8 @@ def reindex( Returns ------- - {klass} with changed index. + {klass} + {klass} with changed index. See Also -------- @@ -5095,7 +5096,7 @@ def reindex( We *highly* recommend using keyword arguments to clarify your intent. - Create a dataframe with some fictional data. + Create a DataFrame with some fictional data. >>> index = ["Firefox", "Chrome", "Safari", "IE10", "Konqueror"] >>> columns = ["http_status", "response_time"] @@ -5112,9 +5113,9 @@ def reindex( IE10 404 0.08 Konqueror 301 1.00 - Create a new index and reindex the dataframe. By default + Create a new index and reindex the DataFrame. By default values in the new index that do not have corresponding - records in the dataframe are assigned ``NaN``. + records in the DataFrame are assigned ``NaN``. >>> new_index = ["Safari", "Iceweasel", "Comodo Dragon", "IE10", "Chrome"] >>> df.reindex(new_index) @@ -5167,7 +5168,7 @@ def reindex( Konqueror 301 NaN To further illustrate the filling functionality in - ``reindex``, we will create a dataframe with a + ``reindex``, we will create a DataFrame with a monotonically increasing index (for example, a sequence of dates). @@ -5184,7 +5185,7 @@ def reindex( 2010-01-05 89.0 2010-01-06 88.0 - Suppose we decide to expand the dataframe to cover a wider + Suppose we decide to expand the DataFrame to cover a wider date range. >>> date_index2 = pd.date_range("12/29/2009", periods=10, freq="D") @@ -5222,12 +5223,12 @@ def reindex( 2010-01-06 88.0 2010-01-07 NaN - Please note that the ``NaN`` value present in the original dataframe + Please note that the ``NaN`` value present in the original DataFrame (at index value 2010-01-03) will not be filled by any of the value propagation schemes. This is because filling while reindexing - does not look at dataframe values, but only compares the original and + does not look at DataFrame values, but only compares the original and desired indexes. If you do want to fill in the ``NaN`` values present - in the original dataframe, use the ``fillna()`` method. + in the original DataFrame, use the ``fillna()`` method. See the :ref:`user guide ` for more. """ @@ -8373,7 +8374,7 @@ def clip( See Also -------- Series.clip : Trim values at input threshold in series. - DataFrame.clip : Trim values at input threshold in dataframe. + DataFrame.clip : Trim values at input threshold in DataFrame. numpy.clip : Clip (limit) the values in an array. Examples @@ -10909,7 +10910,7 @@ def describe( among those with the highest count. For mixed data types provided via a ``DataFrame``, the default is to - return only an analysis of numeric columns. If the dataframe consists + return only an analysis of numeric columns. If the DataFrame consists only of object and categorical data without any numeric columns, the default is to return an analysis of both the object and categorical columns. If ``include='all'`` is provided as an option, the result @@ -12052,7 +12053,7 @@ def last_valid_index(self) -> Hashable: **DataFrames** -Create a dataframe from a dictionary. +Create a DataFrame from a dictionary. >>> df = pd.DataFrame({'col1': [True, True], 'col2': [True, False]}) >>> df