【问题标题】:PapaParse not working (returns empty array)PapaParse 不工作(返回空数组)
【发布时间】:2014-10-23 23:55:53
【问题描述】:

我正在尝试解析此文件的变体(而不是使用制表符作为分隔符,我正在使用以逗号作为分隔符的文件)https://github.com/materechm/Schizophrenia/blob/master/GWAS.txt

这是我的代码,但我得到一个空数组并且没有错误

        var csv = Papa.parse('GWAS.csv', {
        delimiter: ",",
        header: true,
        comments: false,
        complete: function(results) {
        console.log(results);
        }
        });

【问题讨论】:

标签: javascript csv papaparse


【解决方案1】:

没有数据,因为您启用了标题行,所以输入的第一行是标题行(查看 meta 属性以获取在标题行中找到的字段列表)。

您只提供了一行输入,即字符串"GWAS.csv",因此没有数据。

如果您要解析文件,则需要 pass in a File object from the DOMspecify download: true in the config 让 Papa Parse 将输入字符串解释为从中下载输入文件的 URL。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 2012-08-17
    • 2017-07-12
    • 1970-01-01
    相关资源
    最近更新 更多