import of csv files

Tim's Avatar

Tim

14 Dec, 2015 07:30 PM

Hey guys,

i need to write word list which all have different lenghts. At the moment im doing it in excel and its quite complicated to output them in the right csv formation (i imitated the one from the introduction samples reffered by the documentation). The second problem is that the lists that are shorter then the longest list are filled with blank spaces which is making the list longer than it actually is. I attached screenshots to illustrate the procedure and my issues with it.

So my two questions are:

1. Is there an eassy way to create this kind of csv files?
2. How can i eliminate the blank spaces so that i hace a list with only the elements that are actually in the list?

I would be glad if someone would have any advice.
Thanks for your help!
Tim

  1. Support Staff 1 Posted by john on 15 Dec, 2015 12:24 AM

    john's Avatar

    Hi Tim,

    There are two ways of doing this.

    Method 1. Rearrange your csv file so that instead of one column for each property, you have just two columns, one called "Label" and the other called "Value". You can then enter each label/value pair with no empty cells (see attached screenshot).

    To retrieve a list of values for any given property, just attach a filter_data node, set the Key port to "Label" and the Value port to your property name (form, material, etc.). This will give you a list of label/value pairs for that property. To get just the value, attach a lookup node and set its Key port to "Value".

    Method 2. Leave your csv file exactly as it is and just strip off the null values. To do this, first do a lookup on the desired property (as you already did in your final screenshot).

    To remove the null values, attach two equals nodes one after the other. Connect your lookup node to the first equals and leave its Equals port empty; this will return a list of booleans: true if empty, false if anything else. To negate this, attach the second equals node, this time setting the Equals port to "false".

    You will now have a list of booleans that are false for each empty value. Attach your lookup node and this list of booleans to a cull node. This will remove all the empty values.

    In addition to the screenshot, I am attaching two csv files and a sample NodeBox network that demonstrates both methods. Propery1.csv shows how to arrange the data for method 1, property2.csv is a simplified version of your current layout. Property_Lists.ndbx shows both methods side by side.

    Hope that helps!

    John

  2. 2 Posted by Tim on 15 Dec, 2015 12:02 PM

    Tim's Avatar

    Hey John,
    thansk for your quick and elaborate help this was exactly what i was looking for! =)
    Cheers,
    Tim

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • original_list.jpg 519 KB
  • csv_file_in_exel.jpg 898 KB
  • imported_csv_file.jpg 357 KB
  • list_to_long.jpg 209 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

23 Feb, 2024 07:39 PM
23 Feb, 2024 10:02 AM
22 Feb, 2024 05:51 AM
21 Feb, 2024 05:27 PM
21 Feb, 2024 04:49 PM

 

16 Feb, 2024 05:24 PM
06 Feb, 2024 04:45 AM
19 Jan, 2024 09:50 AM
13 Jan, 2024 03:47 AM
05 Jan, 2024 05:10 PM
05 Jan, 2024 04:54 PM