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
from datetime import datetime, timedelta # 사용법: https://dojang.io/mod/page/view.php?id=2463 | |
import FinanceDataReader as fdr | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
from dateutil.relativedelta import relativedelta # month는 timedelta 사용불가 relativedelta | |
def load_data(code, start_date): | |
data = fdr.DataReader(code, start_date) |
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
# Estimating the value of Pi using Monte Carlo simulation | |
# https://comdoc.tistory.com | |
from random import random | |
def is_in(r): | |
x = random() * r * 2 | |
y = random() * r * 2 | |
return (x - r) ** 2 + (y - r) ** 2 <= r ** 2 |
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
# Monty Hall problem | |
# https://comdoc.tistory.com/ | |
# 2020-09-19 | |
from random import randint | |
def monty_hall(): | |
car = randint(0, 2) | |
first_choice = randint(0, 2) |