dask-将_json读入数据帧值错误

dask-将_json读入数据帧值错误,dask,Dask,这里有一个简单的例子:我有一个json文件xaa.json,其内容如下(stackoverflow归档文件中的两行): 要以二进制模式打开文件,只需添加\\“binary\\”标志。 使用该函数读取字符块(二进制或文本模式)。使用函数(它是全局函数)读取整行。 ;“,“Title”:null,“Comments”:“+1,用于说明将使用全局getline()函数而不是成员函数。”} ] 我想将这些json文件加载到dask数据帧中。我使用

这里有一个简单的例子:我有一个json文件xaa.json,其内容如下(stackoverflow归档文件中的两行):

要以二进制模式打开文件,只需添加\\“binary\\”标志。

使用该函数读取字符块(二进制或文本模式)。使用函数(它是全局函数)读取整行。

;“,“Title”:null,“Comments”:“+1,用于说明将使用全局getline()函数而不是成员函数。”} ] 我想将这些json文件加载到dask数据帧中。我使用:

我得到这个错误:

在查看内容后,我发现是“\\”的东西导致了它。因此,当我删除它们时,(编辑器IntelliJ说它是干净漂亮的JSON),当我运行相同的read_JSON时,它能够读入df并很好地显示它们

因此,我有两个问题:(a)read_json参数“errors”的值是多少?(b)在读取到dask数据帧之前,如何正确预处理json文件?双引号和双转义的存在似乎导致了一个问题


[这可能根本不是dask问题…]…

这在熊猫身上也会失败。阅读json。我建议首先尝试让熊猫的工作正常进行,然后在dask dataframe上尝试相同的工作负载。在问熊猫问题时,您可能会得到更好的支持

[
  {"Id": 11, "Body": "<p>Given a specific <code>DateTime</code> value", "Title": "Calculate relative time in C#", "Comments": "There is the .net package https://github.com/NickStrupat/TimeAgo which pretty much does what is being asked."},
  {"Id": 7888, "Body": "<p>You need to use an <a href=\\"http://en.cppreference.com/w/cpp/io/basic_ifstream\\" rel=\\"noreferrer\\"><code>ifstream</code></a> if you just want to read (use an <code>ofstream</code> to write, or an <code>fstream</code> for both).</p>&#xA;&#xA;<p>To open a file in text mode, do the following:</p>&#xA;&#xA;<pre><code>ifstream in(\\"filename.ext\\", ios_base::in); // the in flag is optional&#xA;</code></pre>&#xA;&#xA;<p>To open a file in binary mode, you just need to add the \\"binary\\" flag.</p>&#xA;&#xA;<pre><code>ifstream in2(\\"filename2.ext\\", ios_base::in | ios_base::binary ); &#xA;</code></pre>&#xA;&#xA;<p>Use the <a href=\\"http://en.cppreference.com/w/cpp/io/basic_istream/read\\" rel=\\"noreferrer\\"><code>ifstream.read()</code></a> function to read a block of characters (in binary or text mode).  Use the <a href=\\"http://en.cppreference.com/w/cpp/string/basic_string/getline\\" rel=\\"noreferrer\\"><code>getline()</code></a> function (it's global) to read an entire line.</p>&#xA;", "Title": null, "Comments": "+1 for noting that the global getline() function is to be used instead of the member function."}
]
so_posts_df = dd.read_json('./xaa.json', orient='columns').compute()
ValueError: Unexpected character found when decoding object value