Skip to content

Instantly share code, notes, and snippets.

View stirlingw's full-sized avatar

Stirling Waite stirlingw

  • Rakuten Marketing
  • Salt Lake City, Utah
View GitHub Profile
import os
import requests
from werkzeug.security import generate_password_hash, check_password_hash
from flask import Flask, render_template, session, send_from_directory, request, redirect, url_for, escape, jsonify, make_response
from flask_session import Session
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
app = Flask(__name__, static_url_path='')

Introduction to Installing PySpark & Jupyter Notebooks on Mac OSX

Spark is used for large-scale distributed data processing. It has become the go to standard for a lot of companies in the technology industry. The Spark framework is capable of computing at high speeds, processing massive amounts of resilient sets of data, and it does it all while computing in a highly distributed manner.

Jupyter Notebooks, commenly called "Jupyter", has been a popular application within the Data Science community for many years.   It enables you to edit, run, and share Python code into a web view. It allows you to execute your code in a step by step process in order to share parts of your code in a very flexible way for data analysis work. This is why Jupyter is a great tool to prototype in, and should be used at all companies that are data centric.

Why use PySpark in a Jupyter Notebook?

Most data engineers argue that the Scala programming language version is more performant than Python version, and it is. Howev

# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@stirlingw
stirlingw / Simple-Form-With-Validation.markdown
Last active August 29, 2015 14:03 — forked from anonymous/Simple-Form-With-Validation.markdown
A single web page application using AngularJS.

Simple Form With Validation

A single web page application using AngularJS. It contains a form within a modal window that has validation. It also lists the people added via the form.

Given more time I would add a directive to search people/dates on the list, orderby, and pagination. It would also have a RemoteService Factory that fetches remote data sources and returns a promise.

See this code in action at CodePen.io