|
262 | 262 | :ref:`io.csv.mixed_timezones` for more.
|
263 | 263 |
|
264 | 264 | Note: A fast-path exists for iso8601-formatted dates.
|
265 |
| -infer_datetime_format : bool, default False |
266 |
| - If True and `parse_dates` is enabled, pandas will attempt to infer the |
267 |
| - format of the datetime strings in the columns, and if it can be inferred, |
268 |
| - switch to a faster method of parsing them. In some cases this can increase |
269 |
| - the parsing speed by 5-10x. |
270 | 265 | keep_date_col : bool, default False
|
271 | 266 | If True and `parse_dates` specifies combining multiple columns then
|
272 | 267 | keep the original columns.
|
|
483 | 478 | "decimal",
|
484 | 479 | "iterator",
|
485 | 480 | "dayfirst",
|
486 |
| - "infer_datetime_format", |
487 | 481 | "verbose",
|
488 | 482 | "skipinitialspace",
|
489 | 483 | "low_memory",
|
@@ -648,7 +642,7 @@ def read_csv(
|
648 | 642 | verbose: bool = ...,
|
649 | 643 | skip_blank_lines: bool = ...,
|
650 | 644 | parse_dates: bool | Sequence[Hashable] | None = ...,
|
651 |
| - infer_datetime_format: bool = ..., |
| 645 | + infer_datetime_format: bool | lib.NoDefault = ..., |
652 | 646 | keep_date_col: bool = ...,
|
653 | 647 | date_parser=...,
|
654 | 648 | dayfirst: bool = ...,
|
@@ -709,7 +703,7 @@ def read_csv(
|
709 | 703 | verbose: bool = ...,
|
710 | 704 | skip_blank_lines: bool = ...,
|
711 | 705 | parse_dates: bool | Sequence[Hashable] | None = ...,
|
712 |
| - infer_datetime_format: bool = ..., |
| 706 | + infer_datetime_format: bool | lib.NoDefault = ..., |
713 | 707 | keep_date_col: bool = ...,
|
714 | 708 | date_parser=...,
|
715 | 709 | dayfirst: bool = ...,
|
@@ -770,7 +764,7 @@ def read_csv(
|
770 | 764 | verbose: bool = ...,
|
771 | 765 | skip_blank_lines: bool = ...,
|
772 | 766 | parse_dates: bool | Sequence[Hashable] | None = ...,
|
773 |
| - infer_datetime_format: bool = ..., |
| 767 | + infer_datetime_format: bool | lib.NoDefault = ..., |
774 | 768 | keep_date_col: bool = ...,
|
775 | 769 | date_parser=...,
|
776 | 770 | dayfirst: bool = ...,
|
@@ -831,7 +825,7 @@ def read_csv(
|
831 | 825 | verbose: bool = ...,
|
832 | 826 | skip_blank_lines: bool = ...,
|
833 | 827 | parse_dates: bool | Sequence[Hashable] | None = ...,
|
834 |
| - infer_datetime_format: bool = ..., |
| 828 | + infer_datetime_format: bool | lib.NoDefault = ..., |
835 | 829 | keep_date_col: bool = ...,
|
836 | 830 | date_parser=...,
|
837 | 831 | dayfirst: bool = ...,
|
@@ -905,7 +899,7 @@ def read_csv(
|
905 | 899 | skip_blank_lines: bool = True,
|
906 | 900 | # Datetime Handling
|
907 | 901 | parse_dates: bool | Sequence[Hashable] | None = None,
|
908 |
| - infer_datetime_format: bool = False, |
| 902 | + infer_datetime_format: bool | lib.NoDefault = lib.no_default, |
909 | 903 | keep_date_col: bool = False,
|
910 | 904 | date_parser=None,
|
911 | 905 | dayfirst: bool = False,
|
@@ -940,6 +934,15 @@ def read_csv(
|
940 | 934 | storage_options: StorageOptions = None,
|
941 | 935 | use_nullable_dtypes: bool = False,
|
942 | 936 | ) -> DataFrame | TextFileReader:
|
| 937 | + if infer_datetime_format is not lib.no_default: |
| 938 | + warnings.warn( |
| 939 | + "The argument 'infer_datetime_format' is deprecated and will " |
| 940 | + "be removed in a future version. " |
| 941 | + "A strict version of it is now the default, see " |
| 942 | + "https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. " |
| 943 | + "You can safely remove this argument.", |
| 944 | + stacklevel=find_stack_level(), |
| 945 | + ) |
943 | 946 | # locals() should never be modified
|
944 | 947 | kwds = locals().copy()
|
945 | 948 | del kwds["filepath_or_buffer"]
|
@@ -992,7 +995,7 @@ def read_table(
|
992 | 995 | verbose: bool = ...,
|
993 | 996 | skip_blank_lines: bool = ...,
|
994 | 997 | parse_dates: bool | Sequence[Hashable] = ...,
|
995 |
| - infer_datetime_format: bool = ..., |
| 998 | + infer_datetime_format: bool | lib.NoDefault = ..., |
996 | 999 | keep_date_col: bool = ...,
|
997 | 1000 | date_parser=...,
|
998 | 1001 | dayfirst: bool = ...,
|
@@ -1053,7 +1056,7 @@ def read_table(
|
1053 | 1056 | verbose: bool = ...,
|
1054 | 1057 | skip_blank_lines: bool = ...,
|
1055 | 1058 | parse_dates: bool | Sequence[Hashable] = ...,
|
1056 |
| - infer_datetime_format: bool = ..., |
| 1059 | + infer_datetime_format: bool | lib.NoDefault = ..., |
1057 | 1060 | keep_date_col: bool = ...,
|
1058 | 1061 | date_parser=...,
|
1059 | 1062 | dayfirst: bool = ...,
|
@@ -1114,7 +1117,7 @@ def read_table(
|
1114 | 1117 | verbose: bool = ...,
|
1115 | 1118 | skip_blank_lines: bool = ...,
|
1116 | 1119 | parse_dates: bool | Sequence[Hashable] = ...,
|
1117 |
| - infer_datetime_format: bool = ..., |
| 1120 | + infer_datetime_format: bool | lib.NoDefault = ..., |
1118 | 1121 | keep_date_col: bool = ...,
|
1119 | 1122 | date_parser=...,
|
1120 | 1123 | dayfirst: bool = ...,
|
@@ -1175,7 +1178,7 @@ def read_table(
|
1175 | 1178 | verbose: bool = ...,
|
1176 | 1179 | skip_blank_lines: bool = ...,
|
1177 | 1180 | parse_dates: bool | Sequence[Hashable] = ...,
|
1178 |
| - infer_datetime_format: bool = ..., |
| 1181 | + infer_datetime_format: bool | lib.NoDefault = ..., |
1179 | 1182 | keep_date_col: bool = ...,
|
1180 | 1183 | date_parser=...,
|
1181 | 1184 | dayfirst: bool = ...,
|
@@ -1249,7 +1252,7 @@ def read_table(
|
1249 | 1252 | skip_blank_lines: bool = True,
|
1250 | 1253 | # Datetime Handling
|
1251 | 1254 | parse_dates: bool | Sequence[Hashable] = False,
|
1252 |
| - infer_datetime_format: bool = False, |
| 1255 | + infer_datetime_format: bool | lib.NoDefault = lib.no_default, |
1253 | 1256 | keep_date_col: bool = False,
|
1254 | 1257 | date_parser=None,
|
1255 | 1258 | dayfirst: bool = False,
|
@@ -1883,10 +1886,6 @@ def TextParser(*args, **kwds) -> TextFileReader:
|
1883 | 1886 | Encoding to use for UTF when reading/writing (ex. 'utf-8')
|
1884 | 1887 | squeeze : bool, default False
|
1885 | 1888 | returns Series if only one column.
|
1886 |
| - infer_datetime_format: bool, default False |
1887 |
| - If True and `parse_dates` is True for a column, try to infer the |
1888 |
| - datetime format based on the first datetime string. If the format |
1889 |
| - can be inferred, there often will be a large parsing speed-up. |
1890 | 1889 | float_precision : str, optional
|
1891 | 1890 | Specifies which converter the C engine should use for floating-point
|
1892 | 1891 | values. The options are `None` or `high` for the ordinary converter,
|
|
0 commit comments