nushell/crates
WMR b67b6f7fc5
Add a datepart expression for dfr to be used with dfr with-column (#9285)
# Description

Today the only way to extract date parts from a dfr series is the dfr
get-* set of commands. These create a new dataframe with just the
datepart in it, which is almost entirely useless. As far as I can tell
there's no way to append it as a series in the original dataframe. In
discussion with fdncred on Discord we decided the best route was to add
an expression for modifying columns created in dfr with-column. These
are the way you manipulate series within a data frame.

I'd like feedback on this approach - I think it's a fair way to handle
things. An example to test it would be:

```[[ record_time]; [ (date now)]]  | dfr into-df | dfr with-column [ ((dfr col record_time) | dfr datepart nanosecond | dfr as "ns" ), (dfr col record_time | dfr datepart second | dfr as "s"), (dfr col record_time | dfr datepart minute | dfr as "m"), (dfr col record_time | dfr datepart hour | dfr as "h") ]```

I'm also proposing we deprecate the dfr get-* commands.  I've not been able to figure out any meaningful way they could ever be useful, and this approach makes more sense by attaching the extracted date part to the row in the original dataframe as a new column.

<!--
Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes.

Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience.
-->

# User-Facing Changes

add in dfr datepart as an expression
<!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. -->

# Tests + Formatting
Need to add some better assertive tests.  I'm also not sure how to properly write the test_dataframe at the bottom, but will revisit as part of this PR.  Wanted to get feedback early.

<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err` to check that you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu  # or use an `env_change` hook to activate it automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->

---------

Co-authored-by: Robert Waugh <robert@waugh.io>
2023-05-30 09:41:18 -05:00
..
nu_plugin_custom_values update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu_plugin_example bump nushell from release version to development version (#9215) 2023-05-17 07:59:01 -05:00
nu_plugin_formats update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu_plugin_gstat update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu_plugin_inc update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu_plugin_python update nu_plugin_python due to signature changes (#8107) 2023-02-18 13:27:24 +00:00
nu_plugin_query update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-cli restore cursor shape when exits (#9314) 2023-05-30 09:38:45 -05:00
nu-cmd-dataframe Add a datepart expression for dfr to be used with dfr with-column (#9285) 2023-05-30 09:41:18 -05:00
nu-cmd-lang Merge stack before printing (#9304) 2023-05-29 19:03:00 -05:00
nu-color-config update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-command Merge stack before printing (#9304) 2023-05-29 19:03:00 -05:00
nu-engine remove unused dependencies (#9230) 2023-05-18 11:37:20 -05:00
nu-explore [nu-explore] fix Cargo description (#9297) 2023-05-27 10:18:39 +02:00
nu-glob Cut down on unnecessary parsing for SyntaxShape::Any (#9280) 2023-05-25 07:53:57 +12:00
nu-json update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-parser fix conflict between filesize and hexadecimal numbers (#9309) 2023-05-28 12:56:58 +02:00
nu-path update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-plugin update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-pretty-hex update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-protocol Merge stack before printing (#9304) 2023-05-29 19:03:00 -05:00
nu-std Merge stack before printing (#9304) 2023-05-29 19:03:00 -05:00
nu-system update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-table update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-term-grid update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-test-support update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
nu-utils update most dependencies except where deeper code changes are needed (#9296) 2023-05-26 10:32:48 -05:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.