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

22 Feb, 2024 05:51 AM
22 Feb, 2024 01:11 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
04 Jan, 2024 11:49 PM