Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
82 views

let df: polars::prelude::DataFrame = read_dataframe(save_path).unwrap(); let texts = df.column("text").unwrap(); let mut counter: i32 = 0; for lemma in texts.try_into(){ counter += 1;...
Uwe.Schneider's user avatar
1 vote
0 answers
89 views

Goal I want to write a function in Rust using the Polars crate that does the following: Copy a Parquet file from one location to another Handle files larger than RAM Not load the entire file into ...
Horowitzathome's user avatar
1 vote
1 answer
26 views

I am updating my rust polars dependencies for 0.46 to 0.48 I am having trouble with the following line df = df.lazy().select(&[col("ts"), col("sensor_id").forward_fill(None), ...
Glenn Pierce's user avatar
2 votes
0 answers
180 views

I'm following polars plugins tutorial - branch mispredictions and it says that theres a faster way to implement the following code: #[polars_expr(output_type=Int64)] fn sum_i64(inputs: &[Series]) -...
Ariana's user avatar
  • 29
1 vote
1 answer
97 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
6 votes
1 answer
202 views

While trying to develop python packages using rust code, I had some problems that seem to preceed the function invocation in rust. I've tried to implement this simple function: use polars::prelude::...
Felipe Vieira's user avatar
4 votes
1 answer
616 views

In Polars 0.46.0 it works normally: let df = df!( "id" => [0, 1, 2, 3, 4], "col_1" => [1, 2, 3, 4, 5], "col_2" => [3, 4, 5, 6, 7], ) .unwrap(); dbg!(&...
Alex Avin's user avatar
1 vote
2 answers
67 views

I have a dataframe where I'm calculating the sum of certain messages within x window (say, 30 seconds). I want to only keep rows where that sum is greater than or equal to 3. Here's my code: async fn ...
sneakycrow's user avatar
5 votes
1 answer
73 views

Does the Polars Expression plugin framework guarantee that chucks are aligned (to avoid footguns)? If I have the following function it appears that it happens: #[polars_expr(output_type=Float64)] fn ...
thoooooooomas's user avatar
0 votes
1 answer
112 views

I'm creating a polars plugin for doing different physical calculations. I have quite a few situations where I have 3 to 5 columns as input. Below is a quite trivial case since it could be implement ...
thoooooooomas's user avatar
1 vote
1 answer
108 views

I am upgrading Polars Rust function from v0.46.0 to v47.1, diff() function broken and the hints Nth(1) not working: error[E0308]: mismatched types --> src/lib.rs:1368:35 | 1368 | ...
weixingsun's user avatar
1 vote
1 answer
210 views

I'm writing a polars plugin that works, but never seems to use more than one CPU. The plugin's function is element-wise, and is marked as such in register_plugin_function. What might I need to do to ...
sclamons's user avatar
  • 103
0 votes
1 answer
65 views

let t_hour_df = hour_df.clone().lazy() .with_column( col("hour").cast(DataType::Datetime(TimeUnit::Nanoseconds,Some(PlSmallStr::from("%Y-%m-%d %H%M")))).alias(&...
shen chu's user avatar
0 votes
0 answers
171 views

I want to read a Parquet file in batches/chunks so I don’t have to have the whole file in RAM. It’s a large file like tens of Gigabytes. I tried BatchedParquetReader, but it still reads the entire ...
Chris's user avatar
  • 3
1 vote
0 answers
69 views

let gaf_df = LazyCsvReader::new(file_path.clone()) .with_has_header(false) .with_separator(b'\t') .finish()?; let gaf_df_select = gaf_df .select([ col(&...
zwh82's user avatar
  • 23
1 vote
1 answer
363 views

I have a very large file generated by other tools, but I don't need all the information, only a few columns of information are enough. When I use Python pandas to read, I can specify the required ...
zwh82's user avatar
  • 23
0 votes
0 answers
96 views

I'm working with a Rust-based data processing pipeline using the polars and arrow2 crates. I have a flow where I batch-read CSVs and write them to an Arrow IPC file using IpcWriter with compression ...
Nirav Patel's user avatar
1 vote
2 answers
145 views

The following code runs: fn main() { let mut df = df! [ "names" => ["a", "b", "c", "d"], "values" => [1, 2, 3, 4], ...
Roger V.'s user avatar
  • 803
1 vote
1 answer
161 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
0 votes
0 answers
273 views

Issue Writing Polars DataFrame in Chunks to Arrow/Parquet Without Corruption What I Am Trying to Do I'm trying to write a Polars DataFrame in chunks to either an Arrow IPC file or a Parquet file ...
Nirav Patel's user avatar
1 vote
2 answers
105 views

I've been trying to figure out how to perform this with the Rust Polars library. But I am still trying to learn Rust and its Polars. And the casting is holding me back. With this code, I get an error ...
OldManSeph's user avatar
  • 2,790
1 vote
1 answer
83 views

In python, just like this df = pl.DataFrame({"foo": ["a", "a", "b"], "bar": [1, 2, 3]}) for name, data in df.group_by("foo"): print(...
Nyssance's user avatar
  • 401
2 votes
1 answer
86 views

I'm trying to calculate the mean of each numeric column in a Polars v0.46.0 DataFrame using Rust, and append the result as a new row at the bottom of the DataFrame. Here's a simplified example of the ...
Fedii's user avatar
  • 23
0 votes
1 answer
189 views

I want get json from polars dataframe, follow this answer Serialize Polars `dataframe` to `serde_json::Value` use polars::prelude::*; fn main() { let df = df! { "a" => [1,2,3,...
Nyssance's user avatar
  • 401
2 votes
1 answer
120 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
1 vote
0 answers
38 views

I have a parquet file with two columns: one of type list[i16] and another of type list[f32]: ┌───────────────┬─────────────────────────────────┐ │ Column A ┆ Column B │ │ --...
PeterPawn's user avatar
1 vote
0 answers
144 views

UPDATE: See this SO post where the streaming engine is used: How do I ensure that a Polars expression plugin properly uses multiple CPUs? Orginial post: I want to write a custom Polars Expression ...
thoooooooomas's user avatar
1 vote
1 answer
145 views

How do I write a Polars expression that switches based on the datatype received? As an example, many Polars operations that work on null values fail on null columns. I want to avoid the computation ...
drhagen's user avatar
  • 9,852
2 votes
2 answers
204 views

The following renames a column in a Polars-Rust dataframe: #![allow(unused_variables)] use polars::prelude::*; fn main() { println!("Hello, world!"); let mut df = df! [ &...
Roger V.'s user avatar
  • 803
0 votes
1 answer
72 views

I would like to create a Plotlars TimeSeriesPlot for 2 time series that have completely different value range. Hence a secondary y-axis would be great for readability (as of now I just see 2 parallel ...
skirc's user avatar
  • 13
0 votes
1 answer
141 views

I am trying to figure out how to get format!() to work when pulling data from a polars dataframe but am not getting the formatting/alignment. It works when passing a String into format!() instead of ...
OldManSeph's user avatar
  • 2,790
4 votes
1 answer
342 views

I am currently comparing different DataFrame based libs in python and rust. Of course I also check pola.rs, as that lib can be used from within both programming languages. I tried to write the same ...
kelko's user avatar
  • 173
1 vote
2 answers
192 views

I have difficulty summing a column in Polars-Rust dataframe. E.g., the folowing snippet: use polars::prelude::*; fn main() { // let numbers = [1, 2, 3, 4, 5]; let n = 5; let numbers: Vec&...
Roger V.'s user avatar
  • 803
1 vote
1 answer
120 views

I've worked through this Polars plugins tutorial, which covers both cumulative iteration through a column using Rust's scan and working with structs as input and output. I got stuck trying to achieve ...
McPeanutbutter's user avatar
-2 votes
1 answer
131 views

I am wondering about the equivalent to the following Python code in Rust: import numpy as np import pandas as pd X = pd.read_csv('./myfile.tsv', sep='\t') X1 = (X > 0).astype(np.float64).T X2 = X1....
Roger V.'s user avatar
  • 803
2 votes
1 answer
128 views

I have a function that creates a ChunkArray<ListType> from two chunk arrays, however I'm having a hard time converting the column function into a "Function Expression". The goal is ...
Trevor Seibert's user avatar
0 votes
1 answer
105 views

Suppose I wanted to add into my dataframe a column for arrays. This can be done easily in the python implementation by specifying the schema at construction. Here is some code to show off my issue fn ...
Harlan Heilman's user avatar
1 vote
1 answer
178 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
0 votes
0 answers
69 views

When using group_by_dynamic() to perform a rolling calculation, my custom geometric mean expression will return a list[f64] dtype for each value instead of a f64. However, when performing the ...
Trevor Seibert's user avatar
1 vote
0 answers
346 views

I am trying to print a dataframe in rust. This is my code: use polars_core::prelude::*; use polars_io::prelude::*; fn main() { let test_df = example(); println!("{:?}", test_df); } ...
Aneesh's user avatar
  • 11
1 vote
1 answer
125 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
0 votes
1 answer
87 views

When creating a Polars Rust Napi function, I am running into a borrower checker error: returns a value referencing data owned by the current function Any help would be appreciated. Thx #[napi(...
Frank's user avatar
  • 634
0 votes
1 answer
61 views

I'm trying to find a way to populate a new field in a dataframe that is the result of a group_by and aggregation. For example, in a measurements dataframe, a column reader, has a list of animal sights ...
sebosp's user avatar
  • 1
1 vote
1 answer
456 views

Using the Polars Rust API, is it possible to create a DataFrame directly from a CSV string / reader while specifying options such as the separator? Currently, I'm working around this by saving the ...
tenxsoydev's user avatar
0 votes
0 answers
117 views

I know there's this question. However the code I want is a little different. [dependencies] ordered-float: "4.4" polars: {version="0.43", features = ["lazy", "...
Jun's user avatar
  • 23
1 vote
1 answer
178 views

In Rust Polars I have a dataframe with columns a and b and a struct MyStruct with fields a and b (with type u64). I want to convert each row of the dataframe into a MyStruct, returning a vector of ...
robertdj's user avatar
  • 1,187
0 votes
1 answer
110 views

I am trying to read SQL Server data to polars DataFrame in Rust with connectorx. However, I never succeeded with windows authentication. When run, it returns Query failed: SourceNotSupport("...
Frank Yang's user avatar
1 vote
1 answer
104 views

I have data that looks like this loaded into Polars: uid groupid thresholds class data1 data2 data3 data4 X1 X 0.0 0 1 1 1 X2 X 0.0 0 1 1 1 X3 X 0.0 0 1 1 1 Y1 Y 0.0 1 1 1 1 Y2 Y 0.0 1 1 1 1 Y3 Y ...
Ganrelka's user avatar
0 votes
1 answer
165 views

I’m working with a CSV file in Rust using the Polars library and successfully read the CSV into a DataFrame. Now, I need to filter the DataFrame based on a specific value in the "City" ...
akhil's user avatar
  • 47
0 votes
2 answers
193 views

Despite the: reading of the polar_lazy 0.44.2 sucessful installation of cargo add polars-lazy the following code results in errors: error[E0433]: failed to resolve: could not find legacy in arrow ...
dark.vador's user avatar

1
2 3 4 5
8