Number formatting
Hi, can anyone kindly explain why after importing the CSV file, some numbers format changes in nodebox?
The problem seems to relate to the 1000 separators, but when using separators it seems to cause further problem of using a dividing note.
Any suggestions how to fix it? Thank you!
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by john on 26 Jan, 2022 11:34 AM
It's a little hard to tell without the file, but for some reason NodeBox is interpreting at least one of these values as a string instead of a number.
There are a number of ways this could happen. You might want to double check your CSV and make sure there is not a typo or anything else amiss.
If you can't fix the problem in your CSV file there is a simple solution in NodeBox. First try feeding the lookup node into a number node to force the value to a number before feeding it into the divide node.
If somehow the separators are actually in the strings, just feed your string value into a replace node. Set the Old parameter to period and the New parameter to nothing. This will strip all the periods out of the string. Once the separators are gone Nodebox will treat it as a number and divide should work fine.
Please let me know if this works. If not, please zip up your NDBX file along with your CSV and attach that to your reply. I will fix it and post the repaired version.
John
2 Posted by suzie on 26 Jan, 2022 02:22 PM
Hi John, I tried the solution but the problem seems remain. I've zipped the file here, can you pls help me check? thanks!
Support Staff 3 Posted by john on 26 Jan, 2022 09:15 PM
Hi Suzie,
I had no trouble when I opened your file. Your CSV did have commas in the Speakers column which forced NodeBox to treat those values as strings. The replace node solved the problem for me.
As proof I used the values to create circles proportional to each speakers count and created a chart (see attached screenshot). I zipped up and attached my modified network.
Please try opening the modified network and see if the chart displays OK for you. If not please send a screenshot with the error. From your earlier screenshot I gather you have your regional settings set to use periods for separators and a comma for the decimal while your data has actual commas embedded for grouping. But since you removed those commas, I don't see why this network shouldn't work for you.
Let me know either way please!
John
4 Posted by suzie on 27 Jan, 2022 11:31 AM
Hi John! yes I can open your sketch fine! Seems like the square-root node did the trick somehow. Just for testing I feed replace node directly to divide again and got another wrong data. Is that the same to you? If not I will try reinstall nodebox. Thanks!
Support Staff 5 Posted by john on 28 Jan, 2022 12:03 AM
Suzie,
Glad it's working for you. The circled value in your screenshot is not an error, just scientific notation (1.31 x 10^7). Above a certain limit Nodebox starts displaying numbers in scientific notation; the E is for exponent.
Good luck with your future projects. Please don't hesitate to write again if you run into any difficulties or have any questions. We all benefit from these discussions.
John
6 Posted by suzie on 31 Jan, 2022 11:19 PM
I see! Thank you so much the thorough explanation and encouragement John:) Will keep exploring and bring more questions over when i run into them!