Skip to content

DOC: Fix docstring errors for pandas.DataFrame.unstack, pandas.DataFrame.value_counts and pandas.DataFrame.tz_localize #58097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.DataFrame.to_period SA01" \
-i "pandas.DataFrame.to_timestamp SA01" \
-i "pandas.DataFrame.tz_convert SA01" \
-i "pandas.DataFrame.tz_localize SA01" \
-i "pandas.DataFrame.unstack RT03" \
-i "pandas.DataFrame.value_counts RT03" \
-i "pandas.DataFrame.var PR01,RT03,SA01" \
-i "pandas.DataFrame.where RT03" \
-i "pandas.DatetimeIndex.ceil SA01" \
Expand Down Expand Up @@ -226,7 +223,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Index.to_list RT03" \
-i "pandas.Index.union PR07,RT03,SA01" \
-i "pandas.Index.unique RT03" \
-i "pandas.Index.value_counts RT03" \
-i "pandas.Index.view GL08" \
-i "pandas.Int16Dtype SA01" \
-i "pandas.Int32Dtype SA01" \
Expand Down Expand Up @@ -482,10 +478,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.to_timestamp RT03,SA01" \
-i "pandas.Series.truediv PR07" \
-i "pandas.Series.tz_convert SA01" \
-i "pandas.Series.tz_localize SA01" \
-i "pandas.Series.unstack SA01" \
-i "pandas.Series.update PR07,SA01" \
-i "pandas.Series.value_counts RT03" \
-i "pandas.Series.var PR01,RT03,SA01" \
-i "pandas.Series.where RT03" \
-i "pandas.SparseDtype SA01" \
Expand Down
1 change: 1 addition & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ def value_counts(
Returns
-------
Series
Series containing counts of unique values.

See Also
--------
Expand Down
11 changes: 7 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -7162,7 +7162,7 @@ def value_counts(
dropna: bool = True,
) -> Series:
"""
Return a Series containing the frequency of each distinct row in the Dataframe.
Return a Series containing the frequency of each distinct row in the DataFrame.

Parameters
----------
Expand All @@ -7175,13 +7175,14 @@ def value_counts(
ascending : bool, default False
Sort in ascending order.
dropna : bool, default True
Don't include counts of rows that contain NA values.
Do not include counts of rows that contain NA values.

.. versionadded:: 1.3.0

Returns
-------
Series
Series containing the frequency of each distinct row in the DataFrame.

See Also
--------
Expand All @@ -7192,8 +7193,8 @@ def value_counts(
The returned Series will have a MultiIndex with one level per input
column but an Index (non-multi) for a single label. By default, rows
that contain any NA values are omitted from the result. By default,
the resulting Series will be in descending order so that the first
element is the most frequently-occurring row.
the resulting Series will be sorted by frequencies in descending order so that
the first element is the most frequently-occurring row.

Examples
--------
Expand Down Expand Up @@ -9658,6 +9659,8 @@ def unstack(
Returns
-------
Series or DataFrame
If index is a MultiIndex: DataFrame with pivoted index labels as new
inner-most level column labels, else Series.

See Also
--------
Expand Down
12 changes: 9 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10485,10 +10485,10 @@ def tz_localize(
nonexistent: TimeNonexistent = "raise",
) -> Self:
"""
Localize tz-naive index of a Series or DataFrame to target time zone.
Localize time zone naive index of a Series or DataFrame to target time zone.

This operation localizes the Index. To localize the values in a
timezone-naive Series, use :meth:`Series.dt.tz_localize`.
time zone naive Series, use :meth:`Series.dt.tz_localize`.

Parameters
----------
Expand Down Expand Up @@ -10548,13 +10548,19 @@ def tz_localize(
Returns
-------
{klass}
Same type as the input.
Same type as the input, with time zone naive or aware index, depending on
``tz``.

Raises
------
TypeError
If the TimeSeries is tz-aware and tz is not None.

See Also
--------
Series.dt.tz_localize: Localize the values in a time zone naive Series.
Timestamp.tz_localize: Localize the Timestamp to a timezone.

Examples
--------
Localize local times:
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4257,6 +4257,10 @@ def unstack(
DataFrame
Unstacked Series.

See Also
--------
DataFrame.unstack : Pivot the MultiIndex of a DataFrame.

Notes
-----
Reference :ref:`the user guide <reshaping.stacking>` for more examples.
Expand Down