Skip to content

Instantly share code, notes, and snippets.

@agoops
agoops / gist:dd3ec3821438b695f7c462877a0fbeb4
Created February 2, 2018 20:27
python - write tuples to csv
with open('test.csv', 'w') as f:
writer = csv.writer(f , lineterminator='\n')
for tup in gdax_times_trades:
writer.writerow(tup)
gdax_times_trades = []
for msg in gdax_stream_json_msgs:
if msg['type'] == 'trade':
msg_time = pd.to_datetime(msg['time'])
msg_price = float(msg['price'])
gdax_times_trades.append( (msg_time, msg_price) )