Skip to content

Instantly share code, notes, and snippets.

@pganti
Created December 18, 2021 04:47
Show Gist options
  • Save pganti/1383f10c0584f58ca3233f1163f64475 to your computer and use it in GitHub Desktop.
Save pganti/1383f10c0584f58ca3233f1163f64475 to your computer and use it in GitHub Desktop.
montecarlo_fcast
import csv
import random
with open("input.csv") as f:
reader = csv.DictReader(f)
lines = list(reader)
samples = list()
results = []
for i in range (100):
for i in range(420):
chosen_row = random.choice(lines)
samples.append(float(chosen_row['TCV'].replace(',', '')))
results.append(sum(samples))
print('\n'.join(map(str, results)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment