我正在尝试解析此文件的变体(我没有使用制表符作为分隔符,而是使用以逗号作为分隔符的文件)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);
}
});
最佳答案
没有数据,因为您启用了标题行,因此输入的第一行是标题行(在 meta
属性中查找标题行中找到的字段列表)。
您只提供了一行输入,即字符串“GWAS.csv”
,因此没有数据。
如果您打算解析文件,则需要 pass in a File object from the DOM或specify download: true
in the config让 Papa Parse 将输入字符串解释为从中下载输入文件的 URL。
关于javascript - PapaParse 不起作用(返回空数组),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26539431/