Skip to content

Instantly share code, notes, and snippets.

@coreyauger
Created May 9, 2018 06:23
Show Gist options
  • Save coreyauger/6413ab8c3b43ed729ec9f62af14b3da7 to your computer and use it in GitHub Desktop.
Save coreyauger/6413ab8c3b43ed729ec9f62af14b3da7 to your computer and use it in GitHub Desktop.
load csv data to numpy arrays
def loadData(path, subset = -1):
allFiles = glob.glob(os.path.join(path, "data_*.csv"))
if(subset > 0):
allFiles = allFiles[0:subset]
data = []
for file in allFiles:
print(file)
with open(file, 'r') as f:
data.append( [float(x[1]) for x in list(csv.reader(f))] )
return np.array(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment