Skip to content

Improved docs for infer_datetime_format #12606

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
wants to merge 4 commits into from

Conversation

robintw
Copy link
Contributor

@robintw robintw commented Mar 13, 2016

Fixes #12152

@@ -132,8 +132,10 @@ class ParserWarning(Warning):

Note: A fast-path exists for iso8601-formatted dates.
infer_datetime_format : boolean, default False
If True and parse_dates is enabled for a column, attempt to infer
the datetime format to speed up the processing
If parse_dates is enabled and this flag is set, pandas will attempt to
Copy link
Contributor

Choose a reason for hiding this comment

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

add if True

@jreback
Copy link
Contributor

jreback commented Mar 13, 2016

pls add to doc-string of pd.to_datetime as well.

@jreback jreback added the Docs label Mar 13, 2016
@jreback jreback added this to the 0.18.1 milestone Mar 13, 2016
@robintw
Copy link
Contributor Author

robintw commented Mar 13, 2016

Thanks - I think I've sorted all of those now.

@jreback
Copy link
Contributor

jreback commented Mar 13, 2016

maybe show an example where this helps (in Examples) mainly for pd.to_datetime

Infer the format from the first entry

>>> pd.to_datetime(df.month + '/' + df.day + '/' + df.year,
infer_datetime_format=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not valid code (as df.month are integers), do something like:

s = df.month.astype(str) + '/' + df.day.astype(str) + '/' + df.year.astype(str)

then infer on that

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 assumed that the df = df.astype(str) from the example above would still have applied.

Should each example be entirely separate?

Copy link
Contributor

Choose a reason for hiding this comment

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

ahh I see that. ok no, that is fine then (maybe rename df -> dfs or something (on the .astype(str) line)

@jreback jreback closed this in 4f5099b Mar 14, 2016
@jreback
Copy link
Contributor

jreback commented Mar 14, 2016

thanks!

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.

2 participants