Skip to content

Improve JavaScript/node/deno docs and user guide #316

@mhkeller

Description

@mhkeller

Ported from here pola-rs/polars#21676

Description

I came to polars from Kyle Kelley's blog post about integrating Deno and Jupyter, which specifically mentions polars as a tool to use with this setup. However, I found the docs for new javascript/deno/node users hard to follow. I'll break down a few general issues I ran into as a new user. Hopefully, these observations could help identify targets to improve upon in an effort to help adoption among JavaScript developers.

Note: I'll use the term JavaScript generally here but consider it as a placeholder for runtimes like nodejs and deno.

  1. The User Guide does not include JavaScript examples

The nodejs-plars page has a link to a User Guide, but that page only shows examples in Python and Rust:

NodeJS docs
Screenshot 2025-03-10 at 14 37 24

Linked User Guide missing JavaScript example
Screenshot 2025-03-10 at 14 37 37

It would be great if the User Guide also included JavaScript in its tutorials.

  1. The nodejs-polars docs don't list intuitive functions and methods from a user's perspective.

The first thing I looked for was information on Polars DataFrames. I clicked DataFrame from the list on the left and it took me to this page, which seems to describe some more internal part of the polars API than a user-facing method. I expected to see something more like a guide that had some examples showing how a user would create a dataframe as well as a list of all of the methods I could do to that dataframe once it was created.

I think the page I'm looking for is this one, which I found by clicking pl under "Namespaces" on that page and then DataFrame under "Interfaces" on that page. This jargon is hard to follow, though.

From this page, it was still hard to find the information I wanted. For instance, it includes 406 lines of TypeScript before listing the methods available on pl.DataFrame in human language.

I'm still a bit confused by how many of them work. For example, I see that minus is a method:

Screenshot 2025-03-10 at 15 05 18

I understand how to subtract one number from another, but what does it mean to subtract something from an entire DataFrame? This could be an opportunity to discuss how these operations work architecturally, when it would work and when it wouldn't, such as with a DataFrame of mixed-string and numeric types.

In general, these docs seem like they were auto-generated from the source code and while they may be "correct" in that sense, they aren't really human navigable, especially for users who aren't coming from a computer science or programming languages background.

For example, the docs for UnderscoreJS list each method with both type definitions, examples and human language. They link to the source so developers who want more detail can dig deeper. I'm not saying you need to follow this exact format but rather as an example of including information at various levels of detail.

  1. Docs could benefit from examples

After I discovered that browsing methods on the pl object was more what I was looking for, I started reading about the readCSV. Here's how it describes its API:

Screenshot 2025-03-10 at 14 56 04

Many users aren't used to reading type annotations, though. And for those that are, it's still useful to have a simple example, similar to what is on the Python and Rust pages, showing how to use this method.

const df = readCSV('/path/to/file.csv', {/* Include some common options here */});

Thanks for all of your work in building this library. I could see it being very helpful to the JavaScript community – especially inside of Jupyter notebooks now that Deno support is there.

Link

https://pola-rs.github.io/nodejs-polars/index.html#node

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions