how do I resolve this? OutOfBoundsDatetime Traceback (most recent call last)
Cell In[59], line 2
1 min_max_date_df = pd.DataFrame()
----> 2 min_date_vars = mds_df[date_variables[9:51]].apply(pd.to_datetime).min()
3 max_date_vars = mds_df[date_variables[9:51]].apply(pd.to_datetime).max()
4 min_max_date_df['Min Date Values'] = min_date_vars
File /opt/conda/lib/python3.10/site-packages/pandas/core/frame.py:10034, in DataFrame.apply(self, func, axis, raw, result_type, args, by_row, **kwargs)
10022 from pandas.core.apply import frame_apply
10024 op = frame_apply(
10025 self,
10026 func=func,
(...)
10032 kwargs=kwargs,
10033 )
10034 return op.apply().finalize(self, method="apply")
File /opt/conda/lib/python3.10/site-packages/pandas/core/apply.py:837, in FrameApply.apply(self)
834 elif self.raw:
835 return self.apply_raw()
--> 837 return self.apply_standard()
File /opt/conda/lib/python3.10/site-packages/pandas/core/apply.py:965, in FrameApply.apply_standard(self)
964 def apply_standard(self):
--> 965 results, res_index = self.apply_series_generator()
967 # wrap results
968 return self.wrap_results(results, res_index)
File /opt/conda/lib/python3.10/site-packages/pandas/core/apply.py:981, in FrameApply.apply_series_generator(self)
978 with option_context("mode.chained_assignment", None):
979 for i, v in enumerate(series_gen):
980 # ignore SettingWithCopy here in case the user mutates
--> 981 results[i] = self.func(v, *self.args, **self.kwargs)
982 if isinstance(results[i], ABCSeries):
983 # If we have a view on v, we need to make a copy because
984 # series_generator will swap out the underlying data
985 results[i] = results[i].copy(deep=False)
File /opt/conda/lib/python3.10/site-packages/pandas/core/tools/datetimes.py:1108, in to_datetime(arg, errors, dayfirst, yearfirst, utc, format, exact, unit, infer_datetime_format, origin, cache)
1106 result = arg.tz_localize("utc")
1107 elif isinstance(arg, ABCSeries):
-> 1108 cache_array = _maybe_cache(arg, format, cache, convert_listlike)
1109 if not cache_array.empty:
1110 result = arg.map(cache_array)
File /opt/conda/lib/python3.10/site-packages/pandas/core/tools/datetimes.py:254, in _maybe_cache(arg, format, cache, convert_listlike)
252 unique_dates = unique(arg)
253 if len(unique_dates) < len(arg):
--> 254 cache_dates = convert_listlike(unique_dates, format)
255 # GH#45319
256 try:
File /opt/conda/lib/python3.10/site-packages/pandas/core/tools/datetimes.py:490, in _convert_listlike_datetimes(arg, format, name, utc, unit, errors, dayfirst, yearfirst, exact)
487 if format is not None and format != "mixed":
488 return _array_strptime_with_fallback(arg, name, utc, format, exact, errors)
--> 490 result, tz_parsed = objects_to_datetime64ns(
491 arg,
492 dayfirst=dayfirst,
493 yearfirst=yearfirst,
494 utc=utc,
495 errors=errors,
496 allow_object=True,
497 )
499 if tz_parsed is not None:
500 # We can take a shortcut since the datetime64 numpy array
501 # is in UTC
502 dta = DatetimeArray(result, dtype=tz_to_dtype(tz_parsed))
File /opt/conda/lib/python3.10/site-packages/pandas/core/arrays/datetimes.py:2346, in objects_to_datetime64ns(data, dayfirst, yearfirst, utc, errors, allow_object)
2343 # if str-dtype, convert
2344 data = np.array(data, copy=False, dtype=np.object_)
-> 2346 result, tz_parsed = tslib.array_to_datetime(
2347 data,
2348 errors=errors,
2349 utc=utc,
2350 dayfirst=dayfirst,
2351 yearfirst=yearfirst,
2352 )
2354 if tz_parsed is not None:
2355 # We can take a shortcut since the datetime64 numpy array
2356 # is in UTC
2357 # Return i8 values to denote unix timestamps
2358 return result.view("i8"), tz_parsed
File tslib.pyx:403, in pandas._libs.tslib.array_to_datetime()
File tslib.pyx:552, in pandas._libs.tslib.array_to_datetime()
File tslib.pyx:491, in pandas._libs.tslib.array_to_datetime()
File np_datetime.pyx:231, in pandas._libs.tslibs.np_datetime.check_dts_bounds()
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 9999-01-01 00:00:00, at position 17