Untitled

 avatar
unknown
plain_text
16 days ago
2.8 kB
4
Indexable
[ERROR]	2025-03-07T13:14:16.094Z	a9f5cfc1-dd96-4bb8-86de-46e02da4f96d	time data "2024-03-25" doesn't match format "%m/%d/%Y", at position 1. You might want to try:
    - passing `format` if your strings have a consistent format;
    - passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format;
    - passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.
Traceback (most recent call last):
  File "/var/task/main.py", line 33, in lambda_handler
    response = apply_src_rules(src_df, event)
  File "/var/task/src/source_rules.py", line 215, in apply_src_rules
    input_df[["entry_date", "trade_date", "settlement_date"]]
  File "/opt/python/pandas/core/frame.py", line 10374, in apply
    return op.apply().__finalize__(self, method="apply")
  File "/opt/python/pandas/core/apply.py", line 916, in apply
    return self.apply_standard()
  File "/opt/python/pandas/core/apply.py", line 1063, in apply_standard
    results, res_index = self.apply_series_generator()
  File "/opt/python/pandas/core/apply.py", line 1081, in apply_series_generator
    results[i] = self.func(v, *self.args, **self.kwargs)
  File "/opt/python/pandas/core/tools/datetimes.py", line 1063, in to_datetime
    cache_array = _maybe_cache(arg, format, cache, convert_listlike)
  File "/opt/python/pandas/core/tools/datetimes.py", line 247, in _maybe_cache
    cache_dates = convert_listlike(unique_dates, format)
  File "/opt/python/pandas/core/tools/datetimes.py", line 433, in _convert_listlike_datetimes
    return _array_strptime_with_fallback(arg, name, utc, format, exact, errors)
  File "/opt/python/pandas/core/tools/datetimes.py", line 467, in _array_strptime_with_fallback
    result, tz_out = array_strptime(arg, fmt, exact=exact, errors=errors, utc=utc)
  File "strptime.pyx", line 501, in pandas._libs.tslibs.strptime.array_strptime
  File "strptime.pyx", line 451, in pandas._libs.tslibs.strptime.array_strptime
  File "strptime.pyx", line 583, in pandas._libs.tslibs.strptime._parse_with_format
ValueError: time data "2024-03-25" doesn't match format "%m/%d/%Y", at position 1. You might want to try:
    - passing `format` if your strings have a consistent format;
    - passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format;
    - passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.


input_df[["entry_date", "trade_date", "settlement_date"]] = (
        input_df[["entry_date", "trade_date", "settlement_date"]]
        .apply(pd.to_datetime)
        .astype(str)
Editor is loading...
Leave a Comment