Skip to content

Instantly share code, notes, and snippets.

View cameres's full-sized avatar

Connor Ameres cameres

View GitHub Profile
@cameres
cameres / compute_correlation_matrix.py
Last active November 22, 2022 14:19
Compute Pandas Correlation Matrix of a Spark Data Frame
from pyspark.mllib.stat import Statistics
import pandas as pd
# result can be used w/ seaborn's heatmap
def compute_correlation_matrix(df, method='pearson'):
# wrapper around
# https://forums.databricks.com/questions/3092/how-to-calculate-correlation-matrix-with-all-colum.html
df_rdd = df.rdd.map(lambda row: row[0:])
corr_mat = Statistics.corr(df_rdd, method=method)
corr_mat_df = pd.DataFrame(corr_mat,
[
{
"date": "2016-01-01",
"line_1": 55.7460227373914,
"line_3": 65.55089867445142,
"line_2": 116.05179943545978
},
{
"date": "2016-01-02",
"line_1": 71.7460227373914,
@cameres
cameres / .profile
Last active December 2, 2016 08:04
Scripts & Files Relevant to Local Hadoop Install on OS X 10.11.
# these aliases can be appended to your .profile, .bashrc, .zshrc, etc.
## replace version w/ version downloaded in brew
## since I installed hadoop 2.7.3, I replace <version> w/ 2.7.3
alias hstart="/usr/local/Cellar/hadoop/<version>/sbin/start-dfs.sh;/usr/local/Cellar/hadoop/<version>/sbin/start-yarn.sh"
alias hstop="/usr/local/Cellar/hadoop/<version>/sbin/stop-yarn.sh;/usr/local/Cellar/hadoop/<version>/sbin/stop-dfs.sh"
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.
@cameres
cameres / index.html
Created May 10, 2016 05:50
Hello, world!
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!
@cameres
cameres / index.html
Created May 10, 2016 05:49
Hello, world!
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!
@cameres
cameres / AudibleiTunesJavascript.scpt
Created March 22, 2016 06:21
A simple script that I created to allow audible to correctly detect audio books.
iTunes = Application('iTunes')
songs = iTunes.selection()
count = 0
for(i = 0; i < songs.length; i++){
songs[i].name = "Part " + count++;
}