天天看点

jupyter notebook误删怎么办

1、如果你不小心删除了单元格,但代码已运行过,且当前页面没有关闭的话

在单元格中输入

history
           

2、你已经关闭了界面的话,可以试试打开检查点文件,一般和.ipynb在同一文件夹下:

jupyter notebook误删怎么办

如果时间间隔较短的话,可以在检查点文件中找到运行过的代码,用记事本打开即可。找到code字段和source字段,source字段里就是原代码啦

{
   "cell_type": "code",  
   "execution_count": null,
   "id": "dfaa6e5a",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\Anaconda3\\lib\\site-packages\\pandas\\core\\indexing.py:1732: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  self._setitem_single_block(indexer, value, name)\n"
     ]
    }
   ],
   "source": [
    "# 完整轨迹\n",
    "list_full = []\n",
    "# 缺失轨迹\n",
    "list_miss = []\n",
    "des=[]\n",
    "turn=[]\n",
    "tcut=[]\n",
    "des_miss=[]\n",
    "turn_miss=[]\n",
    "tcut_miss=[]\n",