rust-polars Questions

4

Solved

Suppose I've got use polars::prelude::*; pub struct Person { id: u32, name: String, age: u32, } let df = df!( "id" => &[1,2,3], "name" => &["John"...
Kessler asked 20/2 at 20:4

2

Solved

I am trying to iterate over each row of a Polars rust dataframe. In this endeavour, I have found df.get but the documentation says that this is slow. Then I have tried df.column("col").ge...
Protector asked 30/5, 2022 at 21:59

1

I was following this answer but it didn't work for me on my version (polars = { version = "0.42.0", features = ["dtype-struct", "lazy", "polars-io"] }). I se...
Chantalchantalle asked 9/9 at 14:47

5

I'd like to apply a user-define function which takes a few inputs (corresponding some columns in a polars DataFrame) to some columns of a polars DataFrame in Rust. The pattern that I'm using is as ...
Cid asked 25/5, 2022 at 6:27

3

Solved

I'm using polars and I would like to define the type of the columns while loading a dataframe. In pandas, I can use dtype: df=pd.read_csv("iris.csv", dtype={'petal_length':str}) I'm tryi...
Lockhart asked 16/4, 2021 at 17:14

1

Solved

I am making a Maturin project involving Polars on both the Python and Rust side. In Python I have a dataframe with columns a and b: import polars as pl df = pl.DataFrame({'a': [1, 2], 'b': ['foo', ...
Teleran asked 7/3 at 8:9

2

Solved

I am trying to add a column of empty lists to a polars dataframe in python. My code import polars as pl a = pl.DataFrame({'a': [1, 2, 3]}) a.with_columns([pl.lit([]).alias('b')]) throws Traceback ...

2

I've encountered an issue while using Polars version 0.37.0 and running cargo clippy for code checking. The error arises in the polars-arrow-0.37.0 crate, specifically in the utf8_to.rs file. Below...
Nikethamide asked 28/1 at 11:53

1

a follow up from Polars lazyframe - add fields from other lazyframe as struct without a `collect`. I now want to join on array items. Currently the only way i know of doing this would be to first e...
Cimbura asked 10/10, 2022 at 15:28

3

Solved

Is there a way to save Polars DataFrame into a database, MS SQL for example? ConnectorX library doesn’t seem to have that option.
Glassful asked 2/2, 2023 at 8:10

0

As stated here, Polars introduced an auto-cache mechanism for LazyFrames that occures multiple times in the logical plan, so the user will not have to actively perform the cache. However, while try...
Bedtime asked 28/11, 2023 at 6:34

2

Solved

Supposing I have a vector of structs like so: struct Test { id:u32, amount:u32 } fn main() { let test_vec:Vec<Test> = vec![Test{id:1,amount:3}, Test{id:3,amount:4}]; } Is there a w...
Henrie asked 29/7, 2022 at 13:19

2

Solved

I have a function which returns a list type column. Hence, one of my columns is a list. I'd like to turn this list column into multiple columns. For example: use polars::prelude::*; use polars::df;...
Winterkill asked 3/6, 2022 at 13:24

2

Solved

I have the following code to find the mean of the ages in the dataframe. let df = df! [ "name" => ["panda", "polarbear", "seahorse"], "age" =&...
Agosto asked 12/11, 2022 at 11:12

1

I have a Python function such as def add_data(input_df): """ some manipulation of input_df (Polars dataframe) such as filling some columns with new values """ I would ...
Lexicology asked 31/1, 2023 at 3:3

1

Solved

I had a hard time finding the answer for such simple question. I was stuck at trying to use "append", "extend" or other methods. Finally I found/realized that the with_column me...
Nadabb asked 28/1, 2023 at 8:51

1

Solved

I'm working with some data frames that contain Unix epochs in ms, and would like to display the entire timestamp series as a date. Unfortunately, the docs did not help me find a polars native way t...
Aloeswood asked 16/12, 2022 at 20:29

1

Solved

I am writing an extern lib for Polars in Rust (for consumption by Raku::Dan) and would like to get out an opaque container for a LazyFrame object by calling df.lazy(). use polars::prelude::*;//{Csv...
Pneuma asked 15/6, 2022 at 21:2

2

Solved

What are the fastest ways to apply functions to polars DataFrames - pl.DataFrame or pl.internals.lazy_frame.LazyFrame? This question is piggy-backing off Apply Function to all columns of a Polars-D...
Ascension asked 9/6, 2022 at 16:17

1

Solved

I am working with Polars in a wasm environment. I have noticed an inconsistency with the LazyFrame.collect operation where it sometimes creates threads when working with certain datasets. Here is t...
Gwendolin asked 27/5, 2022 at 18:52

1

Solved

I am building an interface from Raku NativeCall to Rust Polars to get that cool Arrow2 performance boost. At the high level I would like to work with Polars structs such as DataFrame and Series as ...
Prestigious asked 30/5, 2022 at 17:6

1

Solved

I am reading file using LazyCsvReader and the file contains a date column. LazyCsvReader read the date as string. The date is in format "%m-%d-%Y". How to properly handle it as date. Ther...
Dissatisfied asked 17/5, 2022 at 15:26

2

I need to write my own expression in polars_lazy. Based on my understanding from the source code I need to write a function that returns Expr::Function. The problem is that in order to construct an...
Parthena asked 16/12, 2021 at 23:35

2

Solved

I would like to create a large Polars DataFrame using Rust, building it up row by row using data scraped from web pages. What is an efficient way to do this? It looks like the DataFrame should be c...
Quartziferous asked 23/3, 2022 at 13:57
1

© 2022 - 2024 — McMap. All rights reserved.