我想将数据polars从mysql数据库读入数据帧。我在用sqlx。
sqlx生成结构向量,例如:Vec<Country>如下:
来自sqlx 文档:
// no traits are needed
struct Country { country: String, count: i64 }
let countries = sqlx::query_as!(Country,
"
SELECT country, COUNT(*) as count
FROM users
GROUP BY country
WHERE organization = ?
",
organization
)
.fetch_all(&pool) // -> Vec<Country>
.await?;
// countries[0].country
// countries[0].count
Run Code Online (Sandbox Code Playgroud)
我如何使用它Vec<Country>来生成极坐标数据框
来自polars 文档:
use polars_core::prelude::*;
let s0 = Series::new("a", &[1i64, 2, 3]);
let s1 = Series::new("b", …Run Code Online (Sandbox Code Playgroud)