Skip to content

Instantly share code, notes, and snippets.

View analyticsPierce's full-sized avatar

Jason Pierce analyticsPierce

View GitHub Profile
@analyticsPierce
analyticsPierce / README.md
Created June 12, 2017 23:56 — forked from cstrelioff/README.md
decision trees: scikit-learn + pandas

decision trees: scikit-learn + pandas

This script provides an example of learning a decision tree with scikit-learn. Pandas is used to read data and custom functions are employed to investigate the decision tree after it is learned. Grab the code and try it out.

A blog post about this code is available here, check it out!

@analyticsPierce
analyticsPierce / gist:ea6fda29971aec0d2920bd1fd70c5345
Created September 8, 2016 17:24
openpyxl excel export script
import openpyxl
wb = openpyxl.Workbook()
wb.guess_types = True
sheet = wb.active
with open("test_data.csv") as f:
reader = csv.reader(f)
sheet['D48'].number_format = '#,##0'
sheet['M48'].number_format = '($#,##0.00_);[Red]($#,##0.00)'
@analyticsPierce
analyticsPierce / mailchimp-adhoc-uploader.rb
Created November 12, 2013 16:33
Here is a quick ruby file for sending customer info from a db to a list in mailchimp.
#! /usr/bin/env ruby
require 'logger'
require 'net/http'
require 'mysql2'
require 'gibbon'
@log = Logger.new("/mailchimp_sender_log.log", 5, 1024000)
@log.level = Logger::INFO
@analyticsPierce
analyticsPierce / regex-tester.rb
Last active December 24, 2015 22:19
Here is a helpful script for loading a csv file into an array so you can test regex.
#! /usr/bin/env ruby
require 'csv'
# step 1: import sproducts into an array
@file = "<your path and file>"
@sproducts = []
CSV.foreach(@file, :headers => false) do |row|
@sproducts << row[0]
@analyticsPierce
analyticsPierce / gist:5154104
Last active December 14, 2015 21:49
Here is the test page for my reusable chart pattern.
<!DOCTYPE html>
<html>
<head>
<title>bar chart example</title>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="../example_d3/reusable_bar_chart.js"></script>
<style>
function bar_chart(height,width,data,mod) {
var height = 220,
width = 400;
function my() {
var bar_chart = d3.select("body").append("svg")
.attr("id", "mod-"+mod+"-bar-chart")
.attr("class", "bar_chart")
.attr("width", width)
.attr("height", height)
@analyticsPierce
analyticsPierce / crossdomain.xml
Created December 5, 2012 17:31
crossdomain.xml example
<cross-domain-policy>
<allow-access-from domain="*.brightcove.com" secure="false"></allow-access-from>
<allow-http-request-headers-from domain="*.brightcove.com" headers="*" secure="false"></allow-http-request-headers-from>
</cross-domain-policy>