-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: camelCase in offsets, get_offset #30340
Conversation
@datapythonista the good news is im able to reproduce this locally with
ideas? |
We fixed a lot of these in the past, but I'm not sure if we ever understood the problem. At least I don't think I did. I think what we do is to add the docs being reported to a hidden autosummary. See: https://github.com/pandas-dev/pandas/blame/master/doc/source/reference/index.rst#L44 @jorisvandenbossche probably knows more |
It's because you removed those from the api doc pages, while they are still generated automatically from the class docstring. But so they also need to be included somewhere in another autosummary that adds them into the toctree. So like Marc said, we use hidden autosummaries to solve this. There should be some other examples in the api docs of that (look at the bottom of those pages). |
See the "hidden" text in |
thank you both |
@jorisvandenbossche my attempts at mimicing the examples in offset_frequency.rst haven't worked. in this commit i used "api.offsets.Foo.onOffset" but itt also didn't work with "Foo.onOffset", "api/Foo.onOffset", "pandas.tseries.offsets.Foo.onOffset" |
The toctree needs the path (which becomes the url, eg https://dev.pandas.io/docs/reference/api/pandas.tseries.offsets.DateOffset.isAnchored.html), so you need something like |
@jorisvandenbossche see newest commit where i tried just about every variant I could think of, including putting them in a different file where we already use this pattern. |
doc/source/reference/index.rst
Outdated
@@ -61,6 +61,546 @@ public functions related to data types in pandas. | |||
api/pandas.Series.from_array | |||
api/pandas.Series.imag | |||
api/pandas.Series.real | |||
..api/pandas.tseries.offsets.DateOffset.isAnchored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you put it here it doesn't need the '..', see the lines above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, didn't see what you did below :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the actual PR, is there any difference between get_offset
and to_offset
that the user should be aware of? (the implementation is not exactly the same)
return self.n == 1 | ||
|
||
def onOffset(self, dt): | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a docstring with a ..deprecated::
directive?
@@ -185,10 +186,29 @@ def get_offset(name: str) -> DateOffset: | |||
""" | |||
Return DateOffset object associated with rule name. | |||
|
|||
.. deprecated:: 1.0.0 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add here that to_offset should be used instead?
I dont think get_offset is supported in a meaningful enough way for this to make sense. e.g. i just found the example in the docstring was wrong |
FutureWarning, | ||
stacklevel=2, | ||
) | ||
return _get_offset(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this call to_offset instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we still need _get_offset internally, just officially telling users to stay away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, would rename maybe if you can (followon ok)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you add a deprecation note in whatsnew?
yes |
great thanks. |
…ndexing-1row-df * upstream/master: (333 commits) CI: troubleshoot Web_and_Docs failing (pandas-dev#30534) WARN: Ignore NumbaPerformanceWarning in test suite (pandas-dev#30525) DEPR: camelCase in offsets, get_offset (pandas-dev#30340) PERF: implement scalar ops blockwise (pandas-dev#29853) DEPR: Remove Series.compress (pandas-dev#30514) ENH: Add numba engine for rolling apply (pandas-dev#30151) [ENH] Add to_markdown method (pandas-dev#30350) DEPR: Deprecate pandas.np module (pandas-dev#30386) ENH: Add ignore_index for df.drop_duplicates (pandas-dev#30405) BUG: The setting xrot=0 in DataFrame.hist() doesn't work with by and subplots pandas-dev#30288 (pandas-dev#30491) CI: Fix GBQ Tests (pandas-dev#30478) Bug groupby quantile listlike q and int columns (pandas-dev#30485) ENH: Add ignore_index for df.sort_values and series.sort_values (pandas-dev#30402) TYP: Typing hints in pandas/io/formats/{css,csvs}.py (pandas-dev#30398) BUG: raise on non-hashable Index name, closes pandas-dev#29069 (pandas-dev#30335) Replace "foo!r" to "repr(foo)" syntax pandas-dev#29886 (pandas-dev#30502) BUG: preserve EA dtype in transpose (pandas-dev#30091) BLD: add check to prevent tempita name error, clsoes pandas-dev#28836 (pandas-dev#30498) REF/TST: method-specific files for test_append (pandas-dev#30503) marked unused parameters (pandas-dev#30504) ...
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff