Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 请帮助解决此问题_Python_Python 3.x_Pandas - Fatal编程技术网

Python 请帮助解决此问题

Python 请帮助解决此问题,python,python-3.x,pandas,Python,Python 3.x,Pandas,问题出在这一行: Traceback (most recent call last): File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc return self._engine.get_loc(key) File "pandas\_libs

问题出在这一行:

Traceback (most recent call last):
  File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
    return self._engine.get_loc(key)
  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: '2021-03-18 00:00:00'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Flipkart\Flipkart\Exe-file\Flipkart AI-V1.3.py", line 169, in <module>
    call_stats_rmt=merging_time_forecast(call_stats_rmt,forecast_rmt,rmt_schedule,rmt_oncall)
  File "c:\Flipkart\Flipkart\Exe-file\Flipkart AI-V1.3.py", line 161, in merging_time_forecast
    Lob['Schedule'] = sch[new_date]
  File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 2800, in __getitem__
    indexer = self.columns.get_loc(key)
  File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: '2021-03-18 00:00:00'
如果您试图通过索引日期获取

使用sch.loc[]

有关更多详细信息,请参阅


因为你还没有发布数据。我只能说调试这个sch[new_date]部分

请让你的问题更具体一些。我建议你给出today_date=dt.date.today.strftime'%Y-%m-%d'和new_date=dt.date.today.strftime'%Y-%m-%d 00:00'也是lob['Schedule']日期时间列或字符串对象列?你正在使用sch['2021-03-18 00:00:00']我想你没有写2021-03-18 00:00:00的专栏?所以你会得到错误。解释你想用2021-03-18 00:00:00做什么?你想得到2021-03-18 00:00:00这一天的所有值吗?它没有帮助,同样的错误来了,你能帮我吗。我将向您提供数据want@SunnyR:只需发布一些数据样本。大学教师;我不需要把所有的数据都放进去。我们可以在别的地方谈一谈吗?我把代码和输出展示给你,这样对你来说就更清楚了understand@SunnyR当前位置邀请我这样聊天。但我现在帮不了你。晚上9点左右见。现在去ofc。cyaok将在9点前接通
Traceback (most recent call last):
  File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
    return self._engine.get_loc(key)
  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: '2021-03-18 00:00:00'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Flipkart\Flipkart\Exe-file\Flipkart AI-V1.3.py", line 169, in <module>
    call_stats_rmt=merging_time_forecast(call_stats_rmt,forecast_rmt,rmt_schedule,rmt_oncall)
  File "c:\Flipkart\Flipkart\Exe-file\Flipkart AI-V1.3.py", line 161, in merging_time_forecast
    Lob['Schedule'] = sch[new_date]
  File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 2800, in __getitem__
    indexer = self.columns.get_loc(key)
  File "C:\Users\COMP\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: '2021-03-18 00:00:00'
Lob['Schedule'] = sch[new_date]