Skip to content
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

DOC: add way to document DatetimeIndex field attributes #5814

Merged

Conversation

jorisvandenbossche
Copy link
Member

Ping @rockg. The docstring is now listed in the autosummary table in api.rst.

Related to issue #5813 (but does not closes it, this only documents the DatetimeIndex field in the api.rst, not more general the Timestamp values).

I added the attribute docstring within the _field_accessor function. Is this a good approach?
You can also document attributes with a docstring line beneath the definition (see Sphinx docs: http://sphinx-doc.org/ext/autodoc.html#directive-autoattribute). The problem with this is that, for the moment, this works for the sphinx autodoc (so the generated pages), but not for the autosummary (there is an open PR for this: https://bitbucket.org/birkenfeld/sphinx/pull-request/142/make-autosummary-work-with-module-class/diff).

@jreback
Copy link
Contributor

jreback commented Jan 1, 2014

@jorisvandenbossche I would say this closes #5813 the issue of wether certain datetime index methods should exist on Series as well is addressed by another issue

(actually it's pretty easy to fix just need a common mixin for series/DatetimeIndex)

the issue though is that these should only apply if the Series has an appropriate dtype (so need some error checking)

@jreback
Copy link
Contributor

jreback commented Jan 1, 2014

@jorisvandenbossche I take that back

#5813 is about Timestamp - so fine to leave open

same approach is needed though - a mixin should work

@rockg
Copy link
Contributor

rockg commented Jan 1, 2014

Very good @jorisvandenbossche. I didn't see that it was Timestamp either. It's not clear where that method comes from (it has to be on the _Timestamp class, but where is that?). Nevertheless, thank you for adding to the DatetimeIndex docs!

@jorisvandenbossche
Copy link
Member Author

The method comes directly from datetime.datetime if I am not mistaken (as Timestamp subclasses datetime). E.g. if you type pd.Timestamp.weekday?, you will see the correct docstring from datetime.
So reagarding issue #5813, the thing left could be to a) add some explanation to one of the tutorials, and/or b) add Timestamp to the api.rst (but this causes problems, see #5218).

@jreback
Copy link
Contributor

jreback commented Jan 1, 2014

@jorisvandenbossche looks fine...merge?

@jorisvandenbossche
Copy link
Member Author

@jreback For me it's OK to merge. I suppose the way I add the docstring is rather straightforward.

jreback added a commit that referenced this pull request Jan 2, 2014
DOC: add way to document DatetimeIndex field attributes
@jreback jreback merged commit 10927a3 into pandas-dev:master Jan 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants