How to Convert List of Strings to List of Floats? - Grasshopper2024-03-28T19:34:14Zhttps://www.grasshopper3d.com/forum/topics/how-to-convert-list-of-strings-to-list-of-floats?commentId=2985220%3AComment%3A1071918&feed=yes&xn_auth=noI solved the issue, thanks to…tag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10718052014-05-17T19:47:33.977ZStephen Maherhttps://www.grasshopper3d.com/profile/StephenPMaher
<p>I solved the issue, thanks to <a href="http://www.grasshopper3d.com/forum/topic/listForContributor?user=2h2kxq6q1lacq" rel="nofollow" target="_blank">djordje</a> pointing out the obvious. I already tried all of the standard and suggested solutions (hinted input 'x' as List Access, etc.), but I had a few invalid items in the CSV.</p>
<p>Thanks for the help. I appreciate all your responses.</p>
<p></p>
<p>Cheers,</p>
<p>/SPM</p>
<p></p>
<p>P.S. …</p>
<p>I solved the issue, thanks to <a rel="nofollow" href="http://www.grasshopper3d.com/forum/topic/listForContributor?user=2h2kxq6q1lacq" target="_blank">djordje</a> pointing out the obvious. I already tried all of the standard and suggested solutions (hinted input 'x' as List Access, etc.), but I had a few invalid items in the CSV.</p>
<p>Thanks for the help. I appreciate all your responses.</p>
<p></p>
<p>Cheers,</p>
<p>/SPM</p>
<p></p>
<p>P.S. <a rel="nofollow" href="http://www.grasshopper3d.com/forum/topic/listForContributor?user=2h2kxq6q1lacq" target="_blank">djordje</a>: I like to make the alterations personally (helps me learn/understand what I'm doing), which is why I withhold my definitions unless requested. Although I totally understand the need for one to dig into the file. I will post all necessary files with my next discussion. Thanks.</p> Check Naruto's reply. Seems l…tag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10718802014-05-17T18:48:41.959Zdjordjehttps://www.grasshopper3d.com/profile/djordje
<p>Check <a rel="nofollow" href="http://www.grasshopper3d.com/xn/detail/2985220:Comment:1071797" target="_blank">Naruto's reply</a>. Seems like you are trying to iterate through "x" list, but you haven't set it up as a list, in the first place.</p>
<p>It's either that, or you have some invalid value in your input (like <null>).<br/>Please attach your .gh file in the future.</p>
<p>Check <a rel="nofollow" href="http://www.grasshopper3d.com/xn/detail/2985220:Comment:1071797" target="_blank">Naruto's reply</a>. Seems like you are trying to iterate through "x" list, but you haven't set it up as a list, in the first place.</p>
<p>It's either that, or you have some invalid value in your input (like <null>).<br/>Please attach your .gh file in the future.</p> You need to select a listtag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10717972014-05-17T18:34:57.046Z筑梦NARUTOhttps://www.grasshopper3d.com/profile/zhumengNARUTO
<p><span>You need to select a list</span></p>
<p><span>You need to select a list</span></p> Du you get all but a few of t…tag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10717012014-05-17T17:51:55.886ZOla Jaenssonhttps://www.grasshopper3d.com/profile/OlaJaensson
<p>Du you get all but a few of the numbers converted?</p>
<p>Could you provide the whole input list?</p>
<p>Do you have any exotic locale set? (though GH seems to eat decimal commas as well as points)</p>
<p>/ola</p>
<p>Du you get all but a few of the numbers converted?</p>
<p>Could you provide the whole input list?</p>
<p>Do you have any exotic locale set? (though GH seems to eat decimal commas as well as points)</p>
<p>/ola</p> Neither are working. I tried…tag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10719182014-05-17T16:43:58.490ZStephen Maherhttps://www.grasshopper3d.com/profile/StephenPMaher
<p>Neither are working. I tried to "force" the output with a [Number] component initially (since that typically works) with no success. I also tried your suggestion, but I get the following runtime error:</p>
<p><em>Runtime error (ValueErrorException): invalid literal for float(): n/a</em></p>
<p><em>Traceback:</em><br></br> <em>line 1, in script</em></p>
<p>Hopefully the image clarifies.</p>
<p>/SPM…</p>
<p>Neither are working. I tried to "force" the output with a [Number] component initially (since that typically works) with no success. I also tried your suggestion, but I get the following runtime error:</p>
<p><em>Runtime error (ValueErrorException): invalid literal for float(): n/a</em></p>
<p><em>Traceback:</em><br/> <em>line 1, in script</em></p>
<p>Hopefully the image clarifies.</p>
<p>/SPM<a href="http://storage.ning.com/topology/rest/1.0/file/get/2768889950?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768889950?profile=RESIZE_1024x1024" width="721" class="align-center"/></a></p> Just an addition to Danny's g…tag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10718222014-05-17T10:18:39.361Zdjordjehttps://www.grasshopper3d.com/profile/djordje
<p>Just an addition to Danny's great answer:</p>
<p>When dealing with python <a href="https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions" target="_blank">list comprehensions</a>, you do not have to define an empty list first. Just write:</p>
<blockquote><p>a = [float(i) for i in x]</p>
</blockquote>
<p></p>
<p>Just an addition to Danny's great answer:</p>
<p>When dealing with python <a href="https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions" target="_blank">list comprehensions</a>, you do not have to define an empty list first. Just write:</p>
<blockquote><p>a = [float(i) for i in x]</p>
</blockquote>
<p></p> Where ever grasshopper requir…tag:www.grasshopper3d.com,2014-05-17:2985220:Comment:10717292014-05-17T06:06:44.351ZDanny Boyeshttps://www.grasshopper3d.com/profile/DannyBoyes
<p>Where ever grasshopper requires numbers instead if text it will convert them. But you can force the issue by using a Number Param component before going into you python component. Or do you what to do this purely in python</p>
<p>Where ever grasshopper requires numbers instead if text it will convert them. But you can force the issue by using a Number Param component before going into you python component. Or do you what to do this purely in python</p>