Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import numpy as np
def process_file(filename, num_cols, delimiter='\t'):
def items(infile):
for line in infile:
for item in line.rstrip().split(delimiter):
yield float(item)
with open(filename, 'r') as infile:
data = np.fromiter(items(infile))
return data.reshape((-1, num_cols))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.