Skip to content

Commit 049f3d3

Browse files
committed
ENH: Support for list of formats in pd.to_datetime() (pandas-dev#55226) pandas-dev#55698
1 parent ce9c526 commit 049f3d3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/core/tools/datetimes.py

+1
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ def to_datetime(
11451145
if not cache_array.empty:
11461146
result = _convert_and_box_cache(argc, cache_array)
11471147
else:
1148+
11481149
#CHANGED HERE
11491150
if isinstance(format, (list, tuple)):
11501151
format = np.array(format, dtype="O")

pandas/tests/tools/test_to_datetime.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1092,9 +1092,9 @@ def test_to_datetime_now_with_format(self, format, expected_ds, string, attribut
10921092
assert (expected - result).max().total_seconds() < 1
10931093

10941094

1095-
#MUDEI AQUI
1095+
#CHANGED HERE
10961096
def test_to_datetime_where_formart_is_list(self):
1097-
# https://github.com/pandas-dev/pandas/issues/55226 Possível teste para essa Issue
1097+
# https://github.com/pandas-dev/pandas/issues/55226
10981098
data = ['2023-10-12','2023-10-13 14:30:00']
10991099
all_formats = ['%Y-m-%d','%Y-%m-%d %H:%M:%S']
11001100
result = to_datetime(data,format=all_formats)

0 commit comments

Comments
 (0)