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: to_datetime format argument examples #17412

Merged
merged 5 commits into from
Sep 18, 2017

Conversation

philipphanemann
Copy link
Contributor

@@ -191,6 +187,25 @@ or ``format``, use ``to_datetime`` if these are required.

pd.Timestamp('2010/11/12')

Providing a Format Argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~
A specific ``format`` argument can be passed in addition to the datetime string.
Copy link
Member

Choose a reason for hiding this comment

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

I would add something like "to ensure a specific and consistent parsing of the string"

Copy link
Member

Choose a reason for hiding this comment

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

Can you also add a blankline between the title and the first sentence ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~
A specific ``format`` argument can be passed in addition to the datetime string.
It will potentially speed up the conversion considerably and on versions later
then 0.13.0.
Copy link
Member

Choose a reason for hiding this comment

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

The "and on versionse later than 0.13.0" can be removed as well

.. note::
Specifying a ``format`` argument will potentially speed up the conversion
considerably and on versions later then 0.13.0 explicitly specifying
a format string of '%Y%m%d' takes a faster path still.
Copy link
Member

Choose a reason for hiding this comment

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

@jreback we removed this part, as it is not a very clear sentence, and also does not seem to be true (#17410)

@codecov
Copy link

codecov bot commented Sep 1, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@9cc3333). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #17412   +/-   ##
=========================================
  Coverage          ?   91.02%           
=========================================
  Files             ?      163           
  Lines             ?    49581           
  Branches          ?        0           
=========================================
  Hits              ?    45130           
  Misses            ?     4451           
  Partials          ?        0
Flag Coverage Δ
#multiple 88.8% <ø> (?)
#single 40.26% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cc3333...4a4bde4. Read the comment docs.

@jorisvandenbossche jorisvandenbossche added this to the 0.21.0 milestone Sep 1, 2017

pd.to_datetime('12-11-2010 00:00', format='%d-%m-%Y %H:%M')

For further format options see: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
Copy link
Contributor

Choose a reason for hiding this comment

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

can you format the link

`text-to-display <linktext>`__

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have put the linktext whithin the arrows and pushed. Hope that'll do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After going through the contribution docs. I rebased and pushed the branch. Sorry for the inconvenience, that I first pushed to master.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm. small changes. pls rebase, ping on green.

@@ -191,6 +187,25 @@ or ``format``, use ``to_datetime`` if these are required.

pd.Timestamp('2010/11/12')

Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a section ref tag here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have put a reference to the pd.Timestamp documentation as above and pushed.

@jorisvandenbossche jorisvandenbossche merged commit 37e23d0 into pandas-dev:master Sep 18, 2017
@jorisvandenbossche
Copy link
Member

@philipphanemann Thanks!
(fixed the merge conflict and removed the link to "timestamp vs timespan/period" (I don't think this was a correct link)

@philipphanemann philipphanemann deleted the format-doc branch September 18, 2017 18:21
alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: new mini-section on specifying formats on datetime parsing
3 participants