The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

NodeBox 3From the old forum

import files with no header

No replies yet

  1. Hi,
    First of all, congrats and thanks for sharing your tool.
    I'm trying to create some visualiztion from data and I wonder if there is a way to read files that don't have headers without loosing the first line?
    I have tried to create a new node with a very simple code to read files (well ordered, with same non-empty columns in every line) from my mid-level python skills but failed miserably... I have absolutely no clue how to create a node that has a file path as input, for example. Let alone check properly for data type from the values.
    Besides, should the node return values for each new line or how should it give back the values it read?

    Here is the tentative code for the new node:

    def read(filename, delim):
    fin = open(filename,'r')
    data = []

    for line in fin:
        s=line.strip().split(delim)
        #Return values for each line or the list after reading all?
        data.append(s)
    
    return data
    

    Cheers!

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply