Skip to content

DOC: TimeStamp.strftime() missing argument description #36745

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
Dr-Irv opened this issue Sep 30, 2020 · 9 comments
Closed

DOC: TimeStamp.strftime() missing argument description #36745

Dr-Irv opened this issue Sep 30, 2020 · 9 comments

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Sep 30, 2020

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.Timestamp.strftime.html?highlight=strftime#pandas.Timestamp.strftime

Documentation problem

The argument for TimeStamp.strftime() is missing in the docs

Suggested fix for documentation

Argument is a format string. Should reference python docs https://docs.python.org/3/library/datetime.html

@TomAugspurger
Copy link
Contributor

I think this is a CPython issue. We subclass datetime.datetime, and don't override strftime.

In [9]: pd.Timestamp.strftime is datetime.datetime.strftime
Out[9]: True

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Sep 30, 2020

@TomAugspurger So how does the doc page for Timestamp.strftime() get generated?

@jorisvandenbossche
Copy link
Member

So how does the doc page for Timestamp.strftime() get generated?

The docstring is inherited as well, so pd.Timestamp.strftime.__doc__ is the docstring of the stdlib (which is not very informative).

We could override the method just to add a more elaborate docstring.

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Sep 30, 2020

I think we'd have to also make sure it picks up the parameter correctly. If you look at the current doc, it doesn't indicate that format is a parameter to Timestamp.strftime() .

Is this possibly an issue with how the methods for datetime.datetime are picked up when we build the docs for Timestamp, and when this happens, we aren't picking up the parameters correctly?

@jorisvandenbossche
Copy link
Member

That's again still an issue with datetime.datetime, which simply has no information about its arguments (eg inspecting the signature of it will fail), and which we inherit

@7astro7
Copy link

7astro7 commented Dec 28, 2020

take

@7astro7
Copy link

7astro7 commented Dec 30, 2020

Hi, does solution to #37559 resolve this? I'm unsure despite the open tag and would appreciate other people's opinions on if this still needs addressing. If unresolved, is ~/pandas/_libs/tslibs/timestamps.pyx the correct file to change the documentation in?

@TomAugspurger
Copy link
Contributor

I think this is being resolved in python/cpython#20677. Nothing to do in pandas.

@7astro7 let us know if you need help finding another issue.

@jorisvandenbossche
Copy link
Member

It was actually resolved by #37559 on the pandas side. That PR added a Timestamp.strftime method overriding the parent datetime.datetime method, to add a docstring.
(and it's probably good to do this anyway, as the upstream python one uses different non-numpydoc docstring formatting)

@jorisvandenbossche jorisvandenbossche mentioned this issue Dec 30, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants