# 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 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
# Allows for working directory to be used on Windows or Linux | |
projectFolder <- "YOURDESKTOPFOLDER" | |
if(Sys.info()['sysname'] == "Linux"){ | |
setwd( paste0( Sys.getenv("HOME") , paste0("/Desktop/", projectFolder, "/") ) ) | |
} else { | |
X <- Sys.getenv('HOME') | |
setwd(gsub("Documents", paste0("/Desktop/", projectFolder, "/"), X)) | |
rm(X) | |
} |
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
# 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" |
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
# 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 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() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import pandas as pd | |
url = 'http://www.econ.yale.edu/~shiller/data/ie_data.xls' | |
data = pd.read_excel(url, 'Data') | |
data |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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