Skip to content

DOC: fix EX02 errors in docstrings #51369

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.Series.sparse.density \
pandas.Series.sparse.npoints \
pandas.Series.sparse.sp_values \
pandas.Timestamp.fromtimestamp \
pandas.api.types.infer_dtype \
pandas.api.types.is_datetime64_any_dtype \
pandas.api.types.is_datetime64_ns_dtype \
Expand All @@ -596,7 +595,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.api.types.is_timedelta64_dtype \
pandas.api.types.is_timedelta64_ns_dtype \
pandas.api.types.is_unsigned_integer_dtype \
pandas.core.groupby.DataFrameGroupBy.take \
pandas.core.groupby.SeriesGroupBy.take \
pandas.io.formats.style.Styler.concat \
pandas.io.formats.style.Styler.export \
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ class Timestamp(_Timestamp):
Examples
--------
>>> pd.Timestamp.fromtimestamp(1584199972)
Timestamp('2020-03-14 15:32:52')
Timestamp('2020-03-14 16:32:52')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the exact output here depends on your tz's local time

In [1]: pd.Timestamp.fromtimestamp(1584199972)
Out[1]: Timestamp('2020-03-14 15:32:52')

In [2]: import os

In [3]: os.environ['TZ'] = 'Europe/Brussels'

In [4]: import time

In [5]: time.tzset()

In [6]: pd.Timestamp.fromtimestamp(1584199972)
Out[6]: Timestamp('2020-03-14 16:32:52')

I think this can probably be just removed directly from ci/code_checks.sh (I presume CI runs in UTC?), or could just doctest skip it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it was my mistake. I had to read the next line 1457.
I guess CI runs in UTC, because I get a one-hour difference running validation locally.

Can we leave pandas.Timestamp.fromtimestamp in ci/code_checks.sh to ignore this function while validating docstrings and use the original example for UTC?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally we shoudn't have the excludes list in ci/code_checks.sh, the objective is to remove that - I think if you add # doctest skip (something like that, check other docstrings for the exact syntax) just to this doctest, and keep it removed from ci/code_checks, that should be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I did as you suggested and updated the PR.


Note that the output may change depending on your local time.
"""
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ def take(

Examples
--------
>>> df = DataFrame([('falcon', 'bird', 389.0),
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
... ('parrot', 'bird', 24.0),
... ('lion', 'mammal', 80.5),
... ('monkey', 'mammal', np.nan),
Expand Down Expand Up @@ -2366,7 +2366,7 @@ def take(

Examples
--------
>>> df = DataFrame([('falcon', 'bird', 389.0),
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
... ('parrot', 'bird', 24.0),
... ('lion', 'mammal', 80.5),
... ('monkey', 'mammal', np.nan),
Expand Down