mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Update polars
to 0.33
(#10672)
# Description Open question: Undocumented behavior for the new argument `ambiguous` to the `as_datetime` methods. I cheated by passing a default (assuming empty string). This appears like an API primarily serving the python impl: https://pola-rs.github.io/polars/py-polars/html/reference/expressions/api/polars.Expr.str.to_datetime.html#polars-expr-str-to-datetime # User-Facing Changes Only dependent on breaking changes to the behavior of polars. # Tests + Formatting No observed changes to tests Manually checked `dfr as-datetime`, doesn't seem to panic.
This commit is contained in:
committed by
GitHub
parent
c5545c59c6
commit
c925537c48
@ -24,7 +24,7 @@ indexmap = { version = "2.0" }
|
||||
num = { version = "0.4", optional = true }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
sqlparser = { version = "0.36.1", optional = true }
|
||||
polars-io = { version = "0.32", features = ["avro"], optional = true }
|
||||
polars-io = { version = "0.33", features = ["avro"], optional = true }
|
||||
|
||||
[dependencies.polars]
|
||||
features = [
|
||||
@ -38,7 +38,7 @@ features = [
|
||||
"dtype-categorical",
|
||||
"dtype-datetime",
|
||||
"dtype-struct",
|
||||
"dynamic_groupby",
|
||||
"dynamic_group_by",
|
||||
"ipc",
|
||||
"is_in",
|
||||
"json",
|
||||
@ -54,7 +54,7 @@ features = [
|
||||
"to_dummies",
|
||||
]
|
||||
optional = true
|
||||
version = "0.32"
|
||||
version = "0.33"
|
||||
|
||||
[features]
|
||||
dataframe = ["num", "polars", "polars-io", "sqlparser"]
|
||||
|
@ -147,7 +147,7 @@ impl SQLContext {
|
||||
.enumerate()
|
||||
.map(|(agg_pj, (proj_p, expr))| (expr.clone(), (proj_p, agg_pj + group_by.len())))
|
||||
.unzip();
|
||||
let agg_df = df.groupby(group_by).agg(agg_projection);
|
||||
let agg_df = df.group_by(group_by).agg(agg_projection);
|
||||
let mut final_proj_pos = groupby_pos
|
||||
.into_iter()
|
||||
.chain(agg_proj_pos)
|
||||
|
@ -131,7 +131,7 @@ impl Command for ToLazyGroupBy {
|
||||
let group_by = NuLazyGroupBy {
|
||||
schema: lazy.schema.clone(),
|
||||
from_eager: lazy.from_eager,
|
||||
group_by: Some(lazy.into_polars().groupby(&expressions)),
|
||||
group_by: Some(lazy.into_polars().group_by(&expressions)),
|
||||
};
|
||||
|
||||
Ok(PipelineData::Value(group_by.into_value(call.head), None))
|
||||
|
@ -148,7 +148,7 @@ fn command(
|
||||
TimeUnit::Nanoseconds,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
&Default::default(),
|
||||
)
|
||||
} else {
|
||||
casted.as_datetime(
|
||||
@ -157,7 +157,7 @@ fn command(
|
||||
false,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
&Default::default(),
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ use nu_protocol::{
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use polars::prelude::IntoSeries;
|
||||
use polars::prelude::{is_in, IntoSeries};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct IsIn;
|
||||
@ -71,16 +71,14 @@ fn command(
|
||||
call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let df = NuDataFrame::try_from_pipeline(input, call.head)?;
|
||||
let df = NuDataFrame::try_from_pipeline(input, call.head)?.as_series(call.head)?;
|
||||
|
||||
let other_value: Value = call.req(engine_state, stack, 0)?;
|
||||
let other_span = other_value.span();
|
||||
let other_df = NuDataFrame::try_from_value(other_value)?;
|
||||
let other = other_df.as_series(other_span)?;
|
||||
|
||||
let mut res = df
|
||||
.as_series(call.head)?
|
||||
.is_in(&other)
|
||||
let mut res = is_in(&df, &other)
|
||||
.map_err(|e| {
|
||||
ShellError::GenericError(
|
||||
"Error finding in other".into(),
|
||||
|
Reference in New Issue
Block a user