Skip to content

Commit 95b616a

Browse files
committed
Teste
1 parent 6ce0c74 commit 95b616a

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

pandas/core/tools/datetimes.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -1145,16 +1145,7 @@ def to_datetime(
11451145
if not cache_array.empty:
11461146
result = _convert_and_box_cache(argc, cache_array)
11471147
else:
1148-
#CHANGED HERE
1149-
if isinstance(format, (list, tuple)):
1150-
format = np.array(format, dtype="O")
1151-
return_list = [] # return list
1152-
for i, fmt in enumerate(format):
1153-
return_temp = convert_listlike(argc[i],fmt) # return object of convert_listlike
1154-
return_list.append(return_temp) # add in return list
1155-
result = DatetimeIndex(return_list) # transformed object in datetimeindex
1156-
else:
1157-
result = convert_listlike(argc, format)
1148+
result = convert_listlike(argc, format)
11581149
else:
11591150
result = convert_listlike(np.array([arg]), format)[0]
11601151
if isinstance(arg, bool) and isinstance(result, np.bool_):

pandas/tests/tools/test_to_datetime.py

-15
Original file line numberDiff line numberDiff line change
@@ -1090,21 +1090,6 @@ def test_to_datetime_now_with_format(self, format, expected_ds, string, attribut
10901090
[expected_ds, getattr(Timestamp, attribute)()], dtype="datetime64[ns, UTC]"
10911091
)
10921092
assert (expected - result).max().total_seconds() < 1
1093-
1094-
1095-
#CHANGED HERE
1096-
def test_to_datetime_where_formart_is_list(self):
1097-
# https://github.com/pandas-dev/pandas/issues/55226
1098-
1099-
data = ['2023-10-12','2023-10-13 14:30:00']
1100-
all_formats = ['%Y-m-%d','%Y-%m-%d %H:%M:%S']
1101-
result = to_datetime(data,format=all_formats)
1102-
expect = DatetimeIndex(
1103-
[to_datetime(data[0],all_formats[0]),to_datetime(data[1],all_formats[1])], dtype="datetime64[ns]"
1104-
)
1105-
1106-
tm.assert_index_equal(result,expect)
1107-
11081093

11091094
@pytest.mark.parametrize(
11101095
"dt", [np.datetime64("2000-01-01"), np.datetime64("2000-01-02")]

0 commit comments

Comments
 (0)