Created
September 3, 2020 07:23
-
-
Save 2torus/0f6c34cd402f7052c4a9060df719504d to your computer and use it in GitHub Desktop.
Compares pandas_market_calendars versions
This file contains hidden or 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 python | |
RUN pip install pandas > /dev/null | |
ARG NEW="false" | |
RUN if [ ${NEW} = "true" ]; then pip install git+https://github.com/2torus/pandas_market_calendars.git@cache-holidays > /dev/null; else pip install pandas_market_calendars==1.4.2 > /dev/null; fi | |
RUN echo "import pandas as pd \n\ | |
from random import sample, seed \n\ | |
import time \n\ | |
random_dates = pd.date_range('2000-1-1', '2019-1-1', freq='D') \n\ | |
seed(0xDEED) \n\ | |
random_dates = sample(random_dates.to_list(), 101) \n\ | |
import pandas_market_calendars as mcal \n\ | |
trade_calendar = mcal.get_calendar('NYSE') \n\ | |
start = time.time() \n\ | |
for begin, end in zip(random_dates, random_dates[1:]): \n\ | |
_ = trade_calendar.valid_days(begin, end) \n\ | |
print(f'{time.time()-start:.2f}') \n\ | |
" > sample.py | |
CMD ["python", "sample.py"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run it with