@@ -387,11 +387,6 @@ The simplest case is to just pass in ``parse_dates=True``:
387
387
# These are python datetime objects
388
388
df.index
389
389
390
- .. ipython :: python
391
- :suppress:
392
-
393
- os.remove(' foo.csv' )
394
-
395
390
It is often the case that we may want to store date and time data separately,
396
391
or store various date fields separately. the ``parse_dates `` keyword can be
397
392
used to specify a combination of columns to parse the dates and/or times from.
@@ -503,36 +498,40 @@ a single date rather than the entire array.
503
498
504
499
Inferring Datetime Format
505
500
~~~~~~~~~~~~~~~~~~~~~~~~~
506
- If you have `parse_dates ` enabled for some or all of your columns, and your
501
+ If you have `` parse_dates ` ` enabled for some or all of your columns, and your
507
502
datetime strings are all formatted the same way, you may get a large speed
508
- up by setting `infer_datetime_format=True `. If set, pandas will attempt
503
+ up by setting `` infer_datetime_format=True ` `. If set, pandas will attempt
509
504
to guess the format of your datetime strings, and then use a faster means
510
505
of parsing the strings. 5-10x parsing speeds have been observed. Pandas
511
506
will fallback to the usual parsing if either the format cannot be guessed
512
507
or the format that was guessed cannot properly parse the entire column
513
- of strings. So in general, `infer_datetime_format ` should not have any
508
+ of strings. So in general, `` infer_datetime_format ` ` should not have any
514
509
negative consequences if enabled.
515
510
516
511
Here are some examples of datetime strings that can be guessed (All
517
512
representing December 30th, 2011 at 00:00:00)
518
513
519
- "20111230"
520
- "2011/12/30"
521
- "20111230 00:00:00"
522
- "12/30/2011 00:00:00"
523
- "30/Dec/2011 00:00:00"
524
- "30/December/2011 00:00:00"
514
+ - "20111230"
515
+ - "2011/12/30"
516
+ - "20111230 00:00:00"
517
+ - "12/30/2011 00:00:00"
518
+ - "30/Dec/2011 00:00:00"
519
+ - "30/December/2011 00:00:00"
525
520
526
- `infer_datetime_format ` is sensitive to `dayfirst `. With ` dayfirst=True `, it
527
- will guess "01/12/2011" to be December 1st. With ` dayfirst=False ` (default)
528
- it will guess "01/12/2011" to be January 12th.
521
+ `` infer_datetime_format `` is sensitive to `` dayfirst `` . With
522
+ `` dayfirst=True ``, it will guess "01/12/2011" to be December 1st. With
523
+ `` dayfirst=False `` (default) it will guess "01/12/2011" to be January 12th.
529
524
530
525
.. ipython :: python
531
526
532
527
# Try to infer the format for the index column
533
528
df = pd.read_csv(' foo.csv' , index_col = 0 , parse_dates = True ,
534
529
infer_datetime_format = True )
535
530
531
+ .. ipython :: python
532
+ :suppress:
533
+
534
+ os.remove(' foo.csv' )
536
535
537
536
International Date Formats
538
537
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments