Skip to main content
Filter by
Sorted by
Tagged with
6 votes
1 answer
132 views

How could I split a column of string into list of list? Minimum example: import polars as pl pl.Config(fmt_table_cell_list_len=6, fmt_str_lengths=100) df = pl.DataFrame({'test': "A,B,C,1\nD,E,F,...
Baffin Chu's user avatar
4 votes
1 answer
100 views

I expected either a or b would be 0.0 (not NaN) and c would always be 0.0. The Polars documentation said to use | as "or" and & as "and". I believe I have the logic right: (((...
Steve Maguire's user avatar
3 votes
3 answers
129 views

I'm quite new to the packages polars and plotnine and have the following code: import polars as pl import polars.selectors as cs from plotnine import * df = pl.read_csv('https://raw.githubusercontent....
René's user avatar
  • 4,919
3 votes
1 answer
115 views

I get a strange error with an inequality inner_join on datetime columns: library(polars) library(tidypolars) library(dplyr) library(lubridate) x <- tibble(id = c(1, 1, 2, 2), t = as....
Anand's user avatar
  • 103
3 votes
1 answer
108 views

I have a df like: # /// script # requires-python = ">=3.13" # dependencies = [ # "polars", # ] # /// import polars as pl df = pl.DataFrame( { "points"...
DJDuque's user avatar
  • 954
2 votes
1 answer
112 views

When I use horizontal cumulative sum followed by unnest, a "literal" column is formed that stays in the schema even when dropped. Here is an example: import polars as pl def ...
Nicolò Cavalleri's user avatar
2 votes
1 answer
69 views

The following used to work: pl.concat_arr(pl.col("X[m]", "Y[m]", "Z[m]")).alias("Antenna_position[m]"), but now (polars 1.31.0) I get an error: Traceback (most ...
Jason Yao's user avatar
2 votes
1 answer
119 views

Polars python, format a column like this df = pl.DataFrame({ "a": [0.15, 0.25] }) result = df.with_columns( pl.format("{}%", (pl.col("a") * 100).round(1)) ) print(...
Nyssance's user avatar
  • 401
2 votes
1 answer
167 views

I have a dictionary of nested columns with the index as key in each one. When i try to convert it to a polars dataframe, it fetches the column names and the values right, but each column has just one ...
Ghost's user avatar
  • 1,594
2 votes
1 answer
326 views

I'm working with a large dataset (~14M rows) using Polars and encountering memory issues despite using the streaming engine. Here's my code: import polars as pl # Read CSV in streaming mode df = pl....
Avi Eini's user avatar
2 votes
2 answers
234 views

I am curious whether I am missing something in the Polars Expression library in how this could be done more efficiently. I have a dataframe of protein sequences, where I would like to create k-long ...
Olga Botvinnik's user avatar
2 votes
0 answers
102 views

I'm currently benchmarking PySpark vs the growing alternative Polars. Basically I'm writing various queries (aggregations, filtering, sorting etc.) and measure the execution time, RAM and CPU. I ...
Ernest P W's user avatar
2 votes
0 answers
219 views

This is for a POC to see if polars can do some things faster/better/cheaper than a current SQL solution. The first test case involves a count(*) over an eight-table join. The eight tables are ...
sicsmpr's user avatar
  • 55
1 vote
2 answers
169 views

As far as I can tell, the following MRE conforms to the relevant documentation: import polars df = polars.read_excel( "/Volumes/Spare/foo.xlsx", engine="calamine", ...
jackal's user avatar
  • 29.1k
1 vote
3 answers
287 views

I have a Polars LazyFrame and would like to add to it columns from another LazyFrame. The two LazyFrames have the same number of rows and different columns. I have tried the following, which doesn't ...
Arun's user avatar
  • 63
1 vote
1 answer
83 views

I have a polars dataframe, and a dictionary. I want to map a column in the dataframe to the keys of the dictionary, and then add the corresponding values as a new column. import polars as pl my_dict =...
falsePockets's user avatar
  • 4,423
1 vote
1 answer
57 views

Is it possible to do something like this in Polars? Like do you need a separate when.then.otherwise for each of the 4 new varialbles, or can you use struct to create multiple new variables from one ...
catquas's user avatar
  • 794
1 vote
1 answer
157 views

I am trying to subset a rust-polars dataframe by the names contained in a different frame: use polars::prelude::*; fn main() { let mut df = df! [ "names" => ["a", &...
Roger V.'s user avatar
  • 803
1 vote
1 answer
175 views

In python I can construct a dataframe with a repeated value like this: import polars as pl df = pl.DataFrame({"foo": [1,2]}).with_columns(bar=pl.lit("baz")) Can this be done in ...
2e0byo's user avatar
  • 6,024
1 vote
1 answer
186 views

I have one dataframe: bos_df_3 that has about a 30k+ rows and another, taxon_ranked_only, with 6 million when I tried to join them using: matching_df = ( pl.LazyFrame(bos_df_3) .join( other=...
Ryan's user avatar
  • 436
1 vote
1 answer
117 views

Goal I have a NumPy array true_direction = np.array([1,2,3]).reshape(1,3) which I want to insert into a Polars DataFrame; that is, repeat this array in every row of the DataFrame. What I have tried ...
Jason Yao's user avatar
1 vote
1 answer
145 views

I'm displaying a data frame in collab but finding that whilst the URL link is showing and being formatted, the underline and link don't go across the entire URL, which goes across a couple of lines, ...
disruptive's user avatar
  • 6,026
1 vote
1 answer
123 views

I trying to implement a custom expression in Rust polars to calculate the geomean of different columns, essentailly replicating the same behavior of .mean() expression where it will apply the ...
Trevor Seibert's user avatar
1 vote
1 answer
93 views

I have an application where I have a futures::TryStream. Still in a streaming fashion, I want to convert this into a polars::LazyFrame. It is important to note that the TryStream comes from the ...
bmitc's user avatar
  • 908
1 vote
0 answers
82 views

In my file I have : { "Car": { "Model": null, "Color": null, } } I use read_delta to read the file: df = df.read_delta(path) At the end, I have an empty df. ...
ninja_minida's user avatar