Created
May 9, 2018 06:23
-
-
Save coreyauger/6413ab8c3b43ed729ec9f62af14b3da7 to your computer and use it in GitHub Desktop.
load csv data to numpy arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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