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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import pandas as pd | |
url = 'http://www.econ.yale.edu/~shiller/data/ie_data.xls' | |
data = pd.read_excel(url, 'Data') | |
data |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# 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
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 os.path import expanduser | |
home = expanduser("~") | |
path = os.path.join(home, 'Desktop') | |
os.chdir(path) | |
os.listdir() |
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
# 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 |
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
# 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" |