Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
ZeccaLehn / tickerDownloads.ipynb
Last active August 17, 2016 01:03
[R] Download All Tickers from both Google and Yahoo Finance in Quandl API
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ZeccaLehn
ZeccaLehn / workingDirPython.md
Last active September 25, 2017 23:58
Python working directory management
import os
# Takes home path and appends working folder to path
os.chdir(os.path.expanduser('~') + '\Desktop') # Set to working folder on Desktop
print(os.getcwd()) # Returns new directory

# Returns path of home directory
os.path.expanduser('~')

os.listdir() # returns list of files in new working directory
@ZeccaLehn
ZeccaLehn / seasonalForecasting.ipynb
Created July 8, 2016 20:06
Seasonally Adjusted Forecasting in R and Anomaly Detection
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ZeccaLehn
ZeccaLehn / XLSDownloader.ipynb
Last active June 29, 2016 20:18
[Python 3] In-Memory XLS Yahoo Finance Stock Downloader Function
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ZeccaLehn
ZeccaLehn / XLSinMemory.py
Created June 28, 2016 20:12
Python XLS In-Memory Downloader
import pandas as pd
url = 'http://www.econ.yale.edu/~shiller/data/ie_data.xls'
data = pd.read_excel(url, 'Data')
data
@ZeccaLehn
ZeccaLehn / ShillerCape.ipynb
Last active June 29, 2016 19:40
[R] Shiller CAPE API
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ZeccaLehn
ZeccaLehn / PandasChange.md
Last active June 28, 2016 21:59
Python Change Pandas DataFrame Variables: String to Float
# Python Change Pandas DataFrame Variables

import pandas as pd

data = [['hello', '1.222', '4', '5.22'], ['world', '66', '4', '6.33'], ['hello', '4.22', '0', '5.24']]
data = pd.DataFrame(data, columns = ['a', 'b', 'c', 'd'])
data
@ZeccaLehn
ZeccaLehn / absPath.py
Last active June 1, 2016 17:23
Change Absolute Path Directory in Python 3
from os.path import expanduser
home = expanduser("~")
path = os.path.join(home, 'Desktop')
os.chdir(path)
os.listdir()
@ZeccaLehn
ZeccaLehn / arulesBinary.r
Last active May 26, 2016 18:27
Adapted Arules Association Rules from Binary Table in [R]
# Adapted Arules Association Rules from Binary Table in R
# https://monsiterdex.wordpress.com/2013/11/01/market-basket-analysis-apriori-algorithm-in-r-part-01/
# https://github.com/A01203249/YouTube-Videos/blob/master/R_code_%26_data/titanic.R
# https://www.youtube.com/watch?v=DQGJhZNhG4M
# http://stackoverflow.com/questions/11659128/how-to-use-cast-or-another-function-to-create-a-binary-table-in-r
dat <- read.table(textConnection("
Group Response
A A
A E
@ZeccaLehn
ZeccaLehn / quandlRfundamentals.R
Created April 14, 2016 18:37
Free Fundamentals Time Series from Quandl (Tangible Book and Equity) [R]
# SF0/MSFT_EQUITY_MRY # Equity
# SF0/MSFT_PB_MRY # Price / Book Value
# SF0/MSFT_SHARESWADIL_MRY # Wavg shares diluted
# SF0/MSFT_SHARESWADIL_MRY # Tangible per share
library(Quandl)
Quandl.api_key("YOURQUANDLKEY")
Ticker <- "FB"