Skip to content

Instantly share code, notes, and snippets.

@marciok
Created August 7, 2018 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marciok/26ac2bfbab9a84314d9280f5df20d832 to your computer and use it in GitHub Desktop.
Save marciok/26ac2bfbab9a84314d9280f5df20d832 to your computer and use it in GitHub Desktop.
import numpy as np
import csv
import matplotlib.pyplot as plt
# 1. Extract Bitcoin prices and number of Google searches.
bitcoin_interest = {}
with open('bitcoin-interest.csv') as f:
reader = csv.reader(f)
for row in reader:
bitcoin_interest[row[0]] = row[1]
price_and_interest = []
with open('market-price.csv') as f:
reader = csv.reader(f)
for row in reader:
# 2. Match the price with search date.
if bitcoin_interest.get(row[0], None):
price_and_interest.append([int(bitcoin_interest.get(row[0])), float(row[1])])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment