Skip to content

Instantly share code, notes, and snippets.

View ch01ca's full-sized avatar

Chris Liu ch01ca

View GitHub Profile
start_session = pd.Timestamp('2017-01-02', tz='utc')
end_session = pd.Timestamp('2017-12-29', tz='utc')
# register the bundle
register(
'eu_stocks', # name we select for the bundle
csvdir_equities(
# name of the directory as specified above (named after data frequency)
['daily'],
# path to directory containing the
@AnasAlmasri
AnasAlmasri / SentimentAnalysis.py
Last active November 9, 2020 04:37
full code
import twitter
# initialize api instance
twitter_api = twitter.Api(consumer_key='YOUR_CONSUMER_KEY',
consumer_secret='YOUR_CONSUMER_SECRET',
access_token_key='YOUR_ACCESS_TOKEN_KEY',
access_token_secret='YOUR_ACCESS_TOKEN_SECRET')
# test authentication
print(twitter_api.VerifyCredentials())
@ceshine
ceshine / jupyter_notebook_config.py
Created August 23, 2017 12:31
Jupyter Notebook Post-save Hook: Auto-convert a Python script and a HTML from the notebook
# Reference: https://svds.com/jupyter-notebook-best-practices-for-data-science/
import os
from subprocess import check_call
def post_save(model, os_path, contents_manager):
"""post-save hook for converting notebooks to .py scripts"""
if model['type'] != 'notebook':
return # only do this for notebooks
d, fname = os.path.split(os_path)
check_call(['jupyter', 'nbconvert', '--to', 'script', fname], cwd=d)