Issue
I'm trying to display the full width of column in polars dataframe. Given the following polars dataframe:
import polars as pl
df = pl.DataFrame({
'column_1': ['TF-IDF embeddings are done on the initial corpus, with no additional N-Gram representations or further preprocessing', 'In the eager API, the expression is evaluated immediately. The eager API produces results immediately after execution, similar to pandas. The lazy API is similar to Spark, where a plan is formed upon execution of a query, but the plan does not actually access the data until the collect method is called to execute the query in parallel across all CPU cores. In simple terms: Lazy execution means that an expression is not immediately evaluated.'],
'column_2': ['Document clusterings may misrepresent the visualization of document clusterings due to dimensionality reduction (visualization is pleasing for its own sake - rather than for prediction/inference)', 'Polars has two APIs, eager and lazy. In the eager API, the expression is evaluated immediately. The eager API produces results immediately after execution, similar to pandas. The lazy API is similar to Spark, where a plan is formed upon execution of a query, but the plan does not actually access the data until the collect method is called to execute the query in parallel across all CPU cores. In simple terms: Lazy execution means that an expression is not immediately evaluated.']
})
I tried the following:
pl.Config.set_fmt_str_lengths = 200
pl.Config.set_tbl_width_chars = 200
The result:
shape: (2, 2)
┌───────────────────────────────────┬───────────────────────────────────┐
│ column_1 ┆ column_2 │
│ --- ┆ --- │
│ str ┆ str │
╞═══════════════════════════════════╪═══════════════════════════════════╡
│ TF-IDF embeddings are done on th… ┆ Document clusterings may misrepr… │
│ In the eager API, the expression… ┆ Polars has two APIs, eager and l… │
└───────────────────────────────────┴───────────────────────────────────┘
How can I display the full width of columns in a polars DataFrame in Python?
Thanks in advance!
Solution
I think you can use glimpse
:
> df.glimpse()
Rows: 2
Columns: 2
$ column_1 <str> TF-IDF embeddings are done on the initial corpus, with no additional N-Gram representations or further preprocessing, In the eager API, the expression is evaluated immediately. The eager API produces results immediately after execution, similar to pandas. The lazy API is similar to Spark, where a plan is formed upon execution of a query, but the plan does not actually access the data until the collect method is called to execute the query in parallel across all CPU cores. In simple terms: Lazy execution means that an expression is not immediately evaluated.
$ column_2 <str> Document clusterings may misrepresent the visualization of document clusterings due to dimensionality reduction (visualization is pleasing for its own sake - rather than for prediction/inference), Polars has two APIs, eager and lazy. In the eager API, the expression is evaluated immediately. The eager API produces results immediately after execution, similar to pandas. The lazy API is similar to Spark, where a plan is formed upon execution of a query, but the plan does not actually access the data until the collect method is called to execute the query in parallel across all CPU cores. In simple terms: Lazy execution means that an expression is not immediately evaluated.
Answered By - YOLO
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.