Skip to content

Commit

Permalink
writes to csv via pandas and is somewhat faster
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Zotti authored and Ryan Zotti committed Oct 9, 2016
1 parent 078d847 commit c447d04
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions npz_to_h2o_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ def separate_by_commas(row):
flat_data = predictors.reshape([record_count,240*320*3])
flat_data = np.concatenate((flat_data, targets_np), axis=1)
flat_data = pd.DataFrame(flat_data)
for row in flat_data.iterrows():
with open(output_data_path,'a') as file_writer:
line = separate_by_commas(row[1]) # first element is just a pandas index
file_writer.write(line)
flat_data.to_csv(path_or_buf=data_path + '/' + folder + '/h2o_train.csv')
print("Processed "+str(folder))
print("Finished.")

Expand Down

0 comments on commit c447d04

Please sign in to comment.