2021年3月5日星期五

How to skip lines based on a criteria while loading a CSV file?

I'm trying to load a csv file with D3.js but I want to skip some lines based on some criteria When I apply filter() it says no such function. Any help would be appreciated.

var dataSet = d3.csv("mydata.csv", function(d)         {         // trying to skip the line based on the below condition         if (d.year < 1900)         {            //skip loading, not sure what should I return            return false;          }         else         return {                       name: d.name,            year: d.year,            average_rating: d.average_rating,            user_rated: d.user_rated         };       })  

data.csv:

name,year,average_rating,users_rated  King of Tokyo,2011,7.23048,48611  Love Letter,2012,7.25253,47014  
https://stackoverflow.com/questions/66493465/how-to-skip-lines-based-on-a-criteria-while-loading-a-csv-file March 05, 2021 at 09:29PM

没有评论:

发表评论