Giter VIP home page Giter VIP logo

Comments (6)

ritchie46 avatar ritchie46 commented on May 27, 2024 1

df.head(20).to_string()

from polars.

alexander-beedie avatar alexander-beedie commented on May 27, 2024

Or even just df[:20].to_string() :)

@DeflateAwning: can already achieve this cleanly - doesn't really seem to be any need (or subsequent advantage) for moving the "head" (or "slice") call inside to_string. I don't think we do that anywhere else, so makes sense to keep things consistent/composable here 🤔

from polars.

DeflateAwning avatar DeflateAwning commented on May 27, 2024

Hmm I'm not sure we're talking about the same thing.

In Python:

In [1]: df = pl.DataFrame([{'id': i} for i in range(30)])

In [2]: df
Out[2]: 
shape: (30, 1)
┌─────┐
│ id  │
│ --- │
│ i64 │
╞═════╡
│ 0   │
│ 1   │
│ 2   │
│ 3   │
│ 4   │
│ …   │
│ 25  │
│ 26  │
│ 27  │
│ 28  │
│ 29  │
└─────┘

# Snly 10 rows are visible. I want all 20 rows to be visible.
print(str(df.head(20)))
shape: (20, 1)
┌─────┐
│ id  │
│ --- │
│ i64 │
╞═════╡
│ 0   │
│ 1   │
│ 2   │
│ 3   │
│ 4   │
│ …   │
│ 15  │
│ 16  │
│ 17  │
│ 18  │
│ 19  │
└─────┘

In Rust, I assume the same thing happens.

I see now that the config page has this example:

with pl.Config(tbl_rows=2):
    print(df)

This is what I was looking for in Python.

In Rust however, I don't see an equivalent set_tbl_rows: search. Any advice?

from polars.

cmdlineluser avatar cmdlineluser commented on May 27, 2024

It looks like it sets an env variable:

os.environ["POLARS_FMT_MAX_ROWS"] = str(n)

Which I guess is done with std::env in Rust?

from polars.

DeflateAwning avatar DeflateAwning commented on May 27, 2024

This seems like a bizarre way to communicate what, in my opinion, should be a simple argument.

Imagine if .dt.strftime(...) communicated the date format via an environment variable.

from polars.

cmdlineluser avatar cmdlineluser commented on May 27, 2024

It's very possible I'm missing something here - this was just what I found when trying to figure out how it currently works in py-polars

I'm guessing that eventually the Rust API will have a pl.Config equivalent?

from polars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.