Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
How to load csv data to the console using D3

I am currently learning the basics of D3, and am currently attempting to load a csv file to my console. My problem is that whenever I attempt to load the data, based on online tutorials when I run d3.csv() I should end up with an array, filled with the objects in my csv file.

However, when I inspect the console after running my code, I only see that it has logged each object individually, instead of as an array.

Currently, my html doc looks like this:

<html lang="en">
    <head>
        < meta charset="utf-8">
        < title>D3 Page Template</title>
        < script type="text/javascript" src="../d3.js"></script>
    </head>
    <body>
        <script type="text/javascript">
            d3.select("body").append("p").text("It's a paragraph!");
    </script>
    <script> d3.csv("/data/food.csv", function(data) {
            console.log(data);
        });
    </script>
    </body>
</html>

I have read and watched through numerous tutorials as to how to load this data to the console, though I cannot see what I am not implementing correctly. Intuitively, I expect that once the data is logged to the console, I should be able to call it by simply typing data into the console, or input data[1] to get the first element for example.

Can anyone please help me to understand what I have done incorrectly, and how to log the data correctly? Any insights or guidance are greatly appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!