处理豆瓣电影数据 转换上映日期的时间格式时报错 错误提示ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).
import pandas as pd
df=pd.read_excel("../621/data/豆瓣电影数据.xlsx")
df['上映时间']=pd.to_datetime(df['上映时间'],errors='coerce')
```python
```bash
#####错误显示
ValueError Traceback (most recent call last)
Input In [16], in <cell line: 3>()
1 #object ->datetime
----> 3 df['上映时间']=pd.to_datetime(df['上映时间'],errors='coerce')
File D:\lenovo.bigData\pythonProject\venv\lib\site-packages\pandas\core\tools\datetimes.py:1047, in to_datetime(arg, errors, dayfirst, yearfirst, utc, format, exact, unit, infer_datetime_format, origin, cache)
1045 result = arg.tz_localize(tz)
1046 elif isinstance(arg, ABCSeries):
-> 1047 cache_array = _maybe_cache(arg, format, cache, convert_listlike)
1048 if not cache_array.empty:
1049 result = arg.map(cache_array)
File D:\lenovo.bigData\pythonProject\venv\lib\site-packages\pandas\core\tools\datetimes.py:192, in _maybe_cache(arg, format, cache, convert_listlike)
188 cache_array = Series(dtype=object)
190 if cache:
191 # Perform a quicker unique check
--> 192 if not should_cache(arg):
193 return cache_array
195 unique_dates = unique(arg)
File D:\lenovo.bigData\pythonProject\venv\lib\site-packages\pandas\core\tools\datetimes.py:154, in should_cache(arg, unique_share, check_count)
150 assert 0 < unique_share < 1, "unique_share must be in next bounds: (0; 1)"
152 try:
153 # We can't cache if the items are not hashable.
--> 154 unique_elements = set(islice(arg, check_count))
155 except TypeError:
156 return False
ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).