import files with no header

Marcelo F C Gomes's Avatar

Marcelo F C Gomes

26 Mar, 2013 05:26 PM

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!

Reply to this discussion

Internal reply

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

Attaching KB article:

»

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

18 Nov, 2024 11:24 PM
18 Nov, 2024 09:01 PM
07 Nov, 2024 10:53 AM
02 Nov, 2024 11:22 AM
01 Nov, 2024 12:41 AM

 

01 Oct, 2024 07:59 AM
30 Sep, 2024 11:37 PM
30 Sep, 2024 11:11 AM
30 Sep, 2024 02:37 AM
28 Sep, 2024 10:33 AM
26 Sep, 2024 06:41 AM