Title: How can I read a CSV file into a persistent DataFrame that can be used later in my script? · Issue #686 · javascriptdata/danfojs · GitHub
Open Graph Title: How can I read a CSV file into a persistent DataFrame that can be used later in my script? · Issue #686 · javascriptdata/danfojs
X Title: How can I read a CSV file into a persistent DataFrame that can be used later in my script? · Issue #686 · javascriptdata/danfojs
Description: I am trying to read a CSV file into a DataFrame that I can use later in my code for a Leaflet map. Based on the Danfo.js documentation, here's what my code currently looks like: dfd.readCSV("my_online_csv_file.csv") .then(df => { df.desc...
Open Graph Description: I am trying to read a CSV file into a DataFrame that I can use later in my code for a Leaflet map. Based on the Danfo.js documentation, here's what my code currently looks like: dfd.readCSV("my_onl...
X Description: I am trying to read a CSV file into a DataFrame that I can use later in my code for a Leaflet map. Based on the Danfo.js documentation, here's what my code currently looks like: dfd.readCSV(&qu...
Opengraph URL: https://github.com/javascriptdata/danfojs/issues/686
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How can I read a CSV file into a persistent DataFrame that can be used later in my script?","articleBody":"I am trying to read a CSV file into a DataFrame that I can use later in my code for a Leaflet map. Based on the Danfo.js documentation, here's what my code currently looks like:\n\n```\ndfd.readCSV(\"my_online_csv_file.csv\")\n.then(df =\u003e {\n df.describe().print()\n\n}).catch(err =\u003e {\n console.log(err);\n})\n```\n\nThis code does indeed output some descriptive stats within my console. However, if I then try to access this DataFrame outside this block via `df.head().print();`, I get the following error:\n\n`Uncaught ReferenceError: df is not defined`\n\nI also tried the following setup:\n\n```\ndf_data = dfd.readCSV(\"my_online_csv_file.csv\");\ndf.head().print()\n```\n\nHowever, this produced the following error:\n\n```\nUncaught TypeError: df.head is not a function\n```\n\nIs there an easy way for me to both read in a CSV file and access in later in the function? As a newcomer to both JavaScript and Danfo, I feel like I'm missing something very obvious.\n\n\n","author":{"url":"https://github.com/kburchfiel","@type":"Person","name":"kburchfiel"},"datePublished":"2026-01-07T22:54:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/686/danfojs/issues/686"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c64f2ba0-f03a-beba-9b12-227c73d3791a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2C6:3CDF6F:2C29126:3CE4B5B:6964EF83 |
| html-safe-nonce | 928658a299b10e5d59deeeae9897aca9de18246cdf4e7974c4e67fe9304945b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkM2OjNDREY2RjoyQzI5MTI2OjNDRTRCNUI6Njk2NEVGODMiLCJ2aXNpdG9yX2lkIjoiNzIyMzUxNDQzOTU4NTQyNzMzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dabe4add336e9e693587cd9a47a52def0bc2e0d1f352af2ee0ae675a905edf0f |
| hovercard-subject-tag | issue:3790625961 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/javascriptdata/danfojs/686/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c9b916cb4979c8de975fced87a311f04fc0f86233c96b45fdb02f5fb674d3f4c/javascriptdata/danfojs/issues/686 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c9b916cb4979c8de975fced87a311f04fc0f86233c96b45fdb02f5fb674d3f4c/javascriptdata/danfojs/issues/686 |
| og:image:alt | I am trying to read a CSV file into a DataFrame that I can use later in my code for a Leaflet map. Based on the Danfo.js documentation, here's what my code currently looks like: dfd.readCSV("my_onl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kburchfiel |
| hostname | github.com |
| expected-hostname | github.com |
| None | 53cd8ae9b65b7c4a0ad545ffeb3216839259a92733857ba426906c0655c5419d |
| turbo-cache-control | no-preview |
| go-import | github.com/javascriptdata/danfojs git https://github.com/javascriptdata/danfojs.git |
| octolytics-dimension-user_id | 62061637 |
| octolytics-dimension-user_login | javascriptdata |
| octolytics-dimension-repository_id | 263751330 |
| octolytics-dimension-repository_nwo | javascriptdata/danfojs |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 263751330 |
| octolytics-dimension-repository_network_root_nwo | javascriptdata/danfojs |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c140758368c0a01881f61b83770bd75cfe81e2c4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width