diff --git a/crates/nu-command/src/dataframe/eager/to_nu.rs b/crates/nu-command/src/dataframe/eager/to_nu.rs index 2f8026999d..cc60e2dfbe 100644 --- a/crates/nu-command/src/dataframe/eager/to_nu.rs +++ b/crates/nu-command/src/dataframe/eager/to_nu.rs @@ -71,7 +71,12 @@ fn command( let values = if tail { df.tail(rows, call.head)? } else { - df.head(rows, call.head)? + // if rows is specified, return those rows, otherwise return everything + if rows.is_some() { + df.head(rows, call.head)? + } else { + df.head(Some(df.height()), call.head)? + } }; let value = Value::List { diff --git a/crates/nu-command/src/dataframe/values/nu_dataframe/mod.rs b/crates/nu-command/src/dataframe/values/nu_dataframe/mod.rs index 5b6cd6640e..a902ae0b69 100644 --- a/crates/nu-command/src/dataframe/values/nu_dataframe/mod.rs +++ b/crates/nu-command/src/dataframe/values/nu_dataframe/mod.rs @@ -275,6 +275,10 @@ impl NuDataFrame { } } + pub fn height(&self) -> usize { + self.0.height() + } + pub fn head(&self, rows: Option, span: Span) -> Result, ShellError> { let to_row = rows.unwrap_or(5); let values = self.to_rows(0, to_row, span)?;