在Jupyter中恢复被覆盖的CSV文件

huangapple go评论61阅读模式
英文:

Recover CSV-File in Jupyter that was overwritten

问题

我使用JupyterLab,不小心覆盖了环境中的现有CSV文件。

在我的环境中,一开始有一个名为"data.csv"的文件,我已将其上传到我的环境。现在我不小心在Jupyter笔记本中执行了以下行:

df.to_csv("data.csv")

因此,"data.csv"文件被覆盖为"df"变量(错误的数据框架)的内容。有办法恢复到"data.csv"文件的旧版本吗,还是这个数据集现在丢失了?

谢谢!

英文:

I work with JupyterLab and have accidentally overwritten an existing CSV-File in my environment.

In my environment, there was a "data.csv"-file at first which I have uploaded to my environment.
Now I accidentally executed the following line in my Jupyter-Notebook:

df.to_csv("data.csv")

So the "data.csv"-File was overwritten with the content of the "df" variable (the wrong dataframe).
Is there a way to get back the old version of the "data.csv" file or is this dataset now lost?

Thanks in advance!

答案1

得分: 1

这取决于您的系统设置,而不是 Jupyter。如果您的文件夹是通过 OneDrive 等同步的,可能会有可用的文件历史记录,您可以还原。

我假设该文件不是 Git 存储库的一部分。如果是的话,那将是明显的解决方案。

英文:

This depends not on Jupyter but on your system setup. If your folder was synchronized in, for example, OneDrive there will probably be a file history available which you can restore.

I assume that the file was not part of a Git repo. If so, that would be the obvious solution.

huangapple
  • 本文由 发表于 2023年4月17日 16:10:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76032976.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定