Number formatting

suzie's Avatar

suzie

26 Jan, 2022 10:09 AM

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!

  1. Support Staff 1 Posted by john on 26 Jan, 2022 11:34 AM

    john's Avatar

    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. 2 Posted by suzie on 26 Jan, 2022 02:22 PM

    suzie's Avatar

    Hi John, I tried the solution but the problem seems remain. I've zipped the file here, can you pls help me check? thanks!

  3. Support Staff 3 Posted by john on 26 Jan, 2022 09:15 PM

    john's Avatar

    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. 4 Posted by suzie on 27 Jan, 2022 11:31 AM

    suzie's Avatar

    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!

  5. Support Staff 5 Posted by john on 28 Jan, 2022 12:03 AM

    john's Avatar

    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. 6 Posted by suzie on 31 Jan, 2022 11:19 PM

    suzie's Avatar

    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!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Screen_Shot_2022-01-26_at_9.58.00_AM.png 28.9 KB
  • Screen_Shot_2022-01-26_at_9.57.20_AM.png 51 KB
  • Screen_Shot_2022-01-26_at_10.03.33_AM.png 50.1 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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

Recent Discussions

16 Jun, 2022 05:30 AM
15 Jun, 2022 06:03 AM
06 Jun, 2022 01:07 PM
02 Jun, 2022 11:58 PM
30 May, 2022 07:48 AM

 

24 May, 2022 06:27 PM
20 May, 2022 04:12 PM
05 May, 2022 02:25 AM
03 May, 2022 04:46 AM
01 May, 2022 09:22 AM
18 Apr, 2022 09:01 PM