【问题标题】:How to get rid of this error "b'log/.ipynb_checkpoints' does not exist " when merging two files?合并两个文件时如何摆脱此错误“b'log/.ipynb_checkpoints'不存在”?
【发布时间】:2019-12-14 17:42:50
【问题描述】:

我正在尝试合并来自两个不同文件夹的两个具有相同文件名的文件,如下所示。

import os
import pandas as pd


files_in_log = set(os.listdir('xml'))
files_in_location = set(os.listdir('location'))
#os.mkdir('results')
for filename in files_in_log & files_in_location:
    df1 = pd.read_csv(os.path.join('xml', filename))    
    df2 = pd.read_csv(os.path.join('location', filename))    
    new_df = df2.merge(df1, on=['hour'], how='outer')    
    new_df.to_csv(os.path.join('results', filename))

一开始还好,直到最近出现错误:

b'log/.ipynb_checkpoints' does not exist 

我在 Jupyter 笔记本中使用 Python。 我应该如何摆脱这个错误并让程序正常工作?

【问题讨论】:

  • Error tokenizing data 之类的东西可能会帮助您找到问题文件。查看接受的解决方案。
  • 谢谢。尝试了 engine=python 并且成功了。所以现在唯一的问题是我猜ipynb文件的第二个错误......

标签: python pandas csv jupyter-notebook


【解决方案1】:

我在处理数据集的音频文件时遇到了类似的问题。打开终端并 cd 到有问题的目录并在命令行中输入:

find . -name ".ipynb_checkpoints" -print -delete

这将打印在该目录中找到的所有 .ipynb_checkpoints 并删除它们。

【讨论】:

    猜你喜欢
    • 2019-06-13
    • 1970-01-01
    • 2019-05-07
    • 1970-01-01
    • 2012-03-27
    • 1970-01-01
    • 2015-04-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多