Parsing Quantity from string representation · Issue #181 · python-quantities/python-quantities · GitHub
Skip to content

Parsing Quantity from string representation #181

Open

Description

@JuliaSprenger

Sometimes it is necessary to create a Quantity objects from a plain string representation, e.g. like 3.0 ms or [3 4 5] ms. Parsing these strings in each use case is error prone and it would be nice to have a more generic function provided, e.g. like the one provided by the R quantities package, see https://www.r-spatial.org/r/2018/05/07/parsing-quantities.html#a-flexible-errors-parser.

A first step towards a generic parsing would be the capability of parsing the string representation of a quantity to have a closed loop between the quantity object and it's string representation. Potentially some code used by the R quantities package could be used as inspiration here, like script1 and script2.

Activity

  1. torokati44 commented on Dec 17, 2021

    @torokati44

    +1
    EDIT: A really basic version could be something like this: https://gist.github.com/torokati44/5866f6e9b27190dc219e29fdc71d8a0e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions