Astropy cannot parse inches The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow do I parse a string to a float or int in Python?How do I parse XML in Python?Why can't Python parse this JSON data?ValueError: could not convert string to floatMy beginner python project (calculator) is having trouble with inputsPython str errorLinear Regression could not convert string to floatdatatype conflicts - Strings and Floats in one NumpyArrayCoordinates transformation in AstropyHow to Make Predictions of Data Using Sklearn's RandomForestClassifier

How to stretch delimiters to envolve matrices inside of a kbordermatrix?

Segmentation fault output is suppressed when piping stdin into a function. Why?

Hopping to infinity along a string of digits

Can smartphones with the same camera sensor have different image quality?

Arduino Pro Micro - switch off LEDs

"... to apply for a visa" or "... and applied for a visa"?

What is special about square numbers here?

How do I add random spotting to the same face in cycles?

In horse breeding, what is the female equivalent of putting a horse out "to stud"?

Road tyres vs "Street" tyres for charity ride on MTB Tandem

Are spiders unable to hurt humans, especially very small spiders?

Can the DM override racial traits?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

How to pronounce 1ターン?

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Would an alien lifeform be able to achieve space travel if lacking in vision?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

How should I replace vector<uint8_t>::const_iterator in an API?

What are these Gizmos at Izaña Atmospheric Research Center in Spain?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

Can the prologue be the backstory of your main character?

Didn't get enough time to take a Coding Test - what to do now?

system() function string length limit

How do you keep chess fun when your opponent constantly beats you?



Astropy cannot parse inches



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow do I parse a string to a float or int in Python?How do I parse XML in Python?Why can't Python parse this JSON data?ValueError: could not convert string to floatMy beginner python project (calculator) is having trouble with inputsPython str errorLinear Regression could not convert string to floatdatatype conflicts - Strings and Floats in one NumpyArrayCoordinates transformation in AstropyHow to Make Predictions of Data Using Sklearn's RandomForestClassifier



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to convert inches to mm with astropy.
In input I have unit as string ("inch","mm"). I create for it example function:



 def astro_conv(self, amount: float, fromm: str, to: str) -> float:
u_from = u.Unit(fromm)
u_to = u.Unit(to)
return u_from.to(u_to, amount)


I got message:ValueError'inch' did not parse as unit: At col 0, inch is not a valid unit. I have check documentation and inch should be available: http://docs.astropy.org/en/stable/units/
What am I doing wrong?










share|improve this question

















  • 2





    From the docs ""This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, To include them: import astropy.units as u, u.imperial.enable()

    – BHC
    Mar 8 at 13:40












  • Yes, You are right! I was blind :)

    – Kuba Wenta
    Mar 8 at 13:43


















0















I am trying to convert inches to mm with astropy.
In input I have unit as string ("inch","mm"). I create for it example function:



 def astro_conv(self, amount: float, fromm: str, to: str) -> float:
u_from = u.Unit(fromm)
u_to = u.Unit(to)
return u_from.to(u_to, amount)


I got message:ValueError'inch' did not parse as unit: At col 0, inch is not a valid unit. I have check documentation and inch should be available: http://docs.astropy.org/en/stable/units/
What am I doing wrong?










share|improve this question

















  • 2





    From the docs ""This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, To include them: import astropy.units as u, u.imperial.enable()

    – BHC
    Mar 8 at 13:40












  • Yes, You are right! I was blind :)

    – Kuba Wenta
    Mar 8 at 13:43














0












0








0








I am trying to convert inches to mm with astropy.
In input I have unit as string ("inch","mm"). I create for it example function:



 def astro_conv(self, amount: float, fromm: str, to: str) -> float:
u_from = u.Unit(fromm)
u_to = u.Unit(to)
return u_from.to(u_to, amount)


I got message:ValueError'inch' did not parse as unit: At col 0, inch is not a valid unit. I have check documentation and inch should be available: http://docs.astropy.org/en/stable/units/
What am I doing wrong?










share|improve this question














I am trying to convert inches to mm with astropy.
In input I have unit as string ("inch","mm"). I create for it example function:



 def astro_conv(self, amount: float, fromm: str, to: str) -> float:
u_from = u.Unit(fromm)
u_to = u.Unit(to)
return u_from.to(u_to, amount)


I got message:ValueError'inch' did not parse as unit: At col 0, inch is not a valid unit. I have check documentation and inch should be available: http://docs.astropy.org/en/stable/units/
What am I doing wrong?







python units-of-measurement astropy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 13:30









Kuba WentaKuba Wenta

191115




191115







  • 2





    From the docs ""This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, To include them: import astropy.units as u, u.imperial.enable()

    – BHC
    Mar 8 at 13:40












  • Yes, You are right! I was blind :)

    – Kuba Wenta
    Mar 8 at 13:43













  • 2





    From the docs ""This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, To include them: import astropy.units as u, u.imperial.enable()

    – BHC
    Mar 8 at 13:40












  • Yes, You are right! I was blind :)

    – Kuba Wenta
    Mar 8 at 13:43








2




2





From the docs ""This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, To include them: import astropy.units as u, u.imperial.enable()

– BHC
Mar 8 at 13:40






From the docs ""This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, To include them: import astropy.units as u, u.imperial.enable()

– BHC
Mar 8 at 13:40














Yes, You are right! I was blind :)

– Kuba Wenta
Mar 8 at 13:43






Yes, You are right! I was blind :)

– Kuba Wenta
Mar 8 at 13:43













1 Answer
1






active

oldest

votes


















1














Per the docs, Astropy does not include imperial units defined by default. I think this is in part to reduce the default units namespace and the overhead involved in creating and searching it, and imperial units get sacrificed in this case since they are less used in astronomy for the most part:




This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, e.g.:




>>> import astropy.units as u
>>> mph = u.imperial.mile / u.hour
>>> mph
Unit("mi / h")



To include them in compose and the results of find_equivalent_units, do:




>>> import astropy.units as u
>>> u.imperial.enable()





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55064249%2fastropy-cannot-parse-inches%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Per the docs, Astropy does not include imperial units defined by default. I think this is in part to reduce the default units namespace and the overhead involved in creating and searching it, and imperial units get sacrificed in this case since they are less used in astronomy for the most part:




    This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, e.g.:




    >>> import astropy.units as u
    >>> mph = u.imperial.mile / u.hour
    >>> mph
    Unit("mi / h")



    To include them in compose and the results of find_equivalent_units, do:




    >>> import astropy.units as u
    >>> u.imperial.enable()





    share|improve this answer



























      1














      Per the docs, Astropy does not include imperial units defined by default. I think this is in part to reduce the default units namespace and the overhead involved in creating and searching it, and imperial units get sacrificed in this case since they are less used in astronomy for the most part:




      This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, e.g.:




      >>> import astropy.units as u
      >>> mph = u.imperial.mile / u.hour
      >>> mph
      Unit("mi / h")



      To include them in compose and the results of find_equivalent_units, do:




      >>> import astropy.units as u
      >>> u.imperial.enable()





      share|improve this answer

























        1












        1








        1







        Per the docs, Astropy does not include imperial units defined by default. I think this is in part to reduce the default units namespace and the overhead involved in creating and searching it, and imperial units get sacrificed in this case since they are less used in astronomy for the most part:




        This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, e.g.:




        >>> import astropy.units as u
        >>> mph = u.imperial.mile / u.hour
        >>> mph
        Unit("mi / h")



        To include them in compose and the results of find_equivalent_units, do:




        >>> import astropy.units as u
        >>> u.imperial.enable()





        share|improve this answer













        Per the docs, Astropy does not include imperial units defined by default. I think this is in part to reduce the default units namespace and the overhead involved in creating and searching it, and imperial units get sacrificed in this case since they are less used in astronomy for the most part:




        This package defines colloquially used Imperial units. They are available in the astropy.units.imperial namespace, but not in the top-level astropy.units namespace, e.g.:




        >>> import astropy.units as u
        >>> mph = u.imperial.mile / u.hour
        >>> mph
        Unit("mi / h")



        To include them in compose and the results of find_equivalent_units, do:




        >>> import astropy.units as u
        >>> u.imperial.enable()






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 11 at 17:21









        IguananautIguananaut

        8,99513041




        8,99513041





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55064249%2fastropy-cannot-parse-inches%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко