mirror of
https://github.com/nushell/nushell.git
synced 2025-06-25 12:21:37 +02:00
Make polars last consistent with polars first (#15963)
# Description `polars last` will only return one row by default making it consistent with `polars first` # User-Facing Changes - `polars last` will only return one row by default making it consistent with `polars first` Co-authored-by: Jack Wright <jack.wright@nike.com>
This commit is contained in:
parent
aa710eeb9a
commit
7972aea530
@ -3,7 +3,7 @@ use crate::{
|
||||
values::{Column, CustomValueSupport, NuLazyFrame, NuLazyGroupBy, PolarsPluginObject},
|
||||
};
|
||||
|
||||
use crate::values::{NuDataFrame, NuExpression, utils::DEFAULT_ROWS};
|
||||
use crate::values::{NuDataFrame, NuExpression};
|
||||
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
||||
use nu_protocol::{
|
||||
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, SyntaxShape, Type,
|
||||
@ -11,6 +11,8 @@ use nu_protocol::{
|
||||
};
|
||||
use polars::df;
|
||||
|
||||
const DEFAULT_ROWS: usize = 1;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LastDF;
|
||||
|
||||
@ -150,7 +152,7 @@ fn command_groupby(
|
||||
groupby: NuLazyGroupBy,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let rows: Option<usize> = call.opt(0)?;
|
||||
let rows = rows.unwrap_or(1);
|
||||
let rows = rows.unwrap_or(DEFAULT_ROWS);
|
||||
let res = groupby.to_polars().tail(Some(rows));
|
||||
let res: NuLazyFrame = res.into();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user