Skip to content

Instantly share code, notes, and snippets.

View ryanorsinger's full-sized avatar
🎏
Reading the readme... again :)

Ryan Orsinger ryanorsinger

🎏
Reading the readme... again :)
View GitHub Profile
@ryanorsinger
ryanorsinger / planets.csv
Created August 20, 2019 14:47
Pandas Warmups
Planet Mass Diameter DayLength SunDistance OrbitPeriod OrbitVelocity MeanTemperature SurfacePressure Moons Rings MagneticField FirstVisited FirstMission
MERCURY 0.33 4879 4222.6 57.9 88 47.4 167 0 0 No Yes 1974-03-29 Mariner 10
VENUS 4.87 12,104 2802 108.2 224.7 35 464 92 0 No No 1962-08-27 Mariner 2
EARTH 5.97 12,756 24 149.6 365.2 29.8 15 1 1 No Yes NA NA
MOON 0.073 3475 708.7 NA 27.3 1 -20 0 0 No No 1959-09-12 Luna 2
MARS 0.642 6792 24.7 227.9 687 24.1 -65 0.01 2 No No 1965-07-15 Mariner 4
JUPITER 1898 142,984 9.9 778.6 4331 13.1 -110 NA 67 Yes Yes 1973-12-04 Pioneer 10
SATURN 568 120,536 10.7 1433.5 10,747 9.7 -140 NA 62 Yes Yes 1979-09-01 Pioneer 11
URANUS 86.8 51,118 17.2 2872.5 30,589 6.8 -195 NA 27 Yes Yes 1986-01-24 Voyager 2
NEPTUNE 102 49,528 16.1 4495.1 59,800 5.4 -200 NA 14 Yes Yes 1989-08-25 Voyager 2
@ryanorsinger
ryanorsinger / directions.txt
Last active August 28, 2019 19:48
How to re-install mysql 5.7
# Directions to uninstall and reinstall mysql 5.7
brew uninstall mysql
sudo rm -rf /usr/local/var/mysql
brew install mysql
@ryanorsinger
ryanorsinger / Car.java
Created September 2, 2019 01:29
Object Examples
public class Car {
// properties that belong to each object
String make;
String model;
// This runs every time we create the car object. This is the constructor.
public Car(String make, String model) {
this.make = make;
this.model = model;
@ryanorsinger
ryanorsinger / Main.java
Created September 5, 2019 03:58
"A Little Java, A Few Patterns" Starter
abstract class Seasoning {}
class Salt extends Seasoning {
public String toString() {
return "new " + getClass().getName() + "()";
}
}
class Pepper extends Seasoning {
public String toString() {
@ryanorsinger
ryanorsinger / series_exercises.md
Created September 23, 2019 19:47
series_exercises

Make a file named pandas_series.py or pandas_series.ipynb for the following exercises.

Given ["kiwi", "mango", "strawberry", "pineapple", "gala apple", "honeycrisp apple", "tomato", "watermelon", "honeydew", "kiwi", "kiwi", "kiwi", "mango", "blueberry", "blackberry", "gooseberry", "papaya"]

  1. Create a pandas series called fruits to hold the above data.

  2. Run .describe() on the series to see what describe returns for a series of strings.

  3. Run the code necessary to produce only the unique fruit names.

@ryanorsinger
ryanorsinger / pandas_series_example.py
Created September 24, 2019 20:40
pandas series example
# Given the pets series, output the number of vowels in each pet species
import pandas as pd
pets = pd.Series([
"cat",
"dog",
"lizard",
"rock",
"dragon"
])
@ryanorsinger
ryanorsinger / overview.md
Created September 27, 2019 15:18
Data Science Workflow and Overview

our trade/craft

gaining insights from data for actionable decisions data science -> applied interdisciplinary science around using data to make decision

practicing data science is a function

  1. input
  2. process
  3. output

data science workflow

@ryanorsinger
ryanorsinger / big_picture_approach.md
Last active October 7, 2019 14:44
Liberal Arts Approach to Software Development

My liberal-arts (think about programming lanugage like natural language) approach to software engineering and thinking about object orientation

  • use clear language to reduce cognitive overhead

  • blow off details until you need them

  • call things what they are so that what they are is what you call them

  • Think of parts of programming languages as a spoken language (Nouns, verbs, etc...)

  • Solve the easiest problems first to build emotional wellbeing and momentum

  • methods are verbs and verb phrases

  • classes/objects are our proper nouns like User, Transaction, Accounts, BlogPost, etc...

@ryanorsinger
ryanorsinger / data_science.md
Created October 11, 2019 14:26
Useful Libraries

Useful Libraries

Exploratory Data Analysis

For when you want an overview of a pandas DataFrame with significantly more depth than .describe(), try out https://github.com/pandas-profiling/pandas-profiling. Install with conda install -c conda-forge pandas-profiling or pip install pandas-profiling.

Some features of Pandas Profiling include:

  • Essentials like types, unique values, missing values
  • Quantile statistics
  • Descriptive statistics
@ryanorsinger
ryanorsinger / now_we_know.md
Created October 18, 2019 14:29
Now We Know - Rolling Log of Lessons Learned

"ValueError: Length of passed values is 20, index implies 1"

The error message of "ValueError: Length of passed values is 20, index implies 1" most likely comes from comparing a numpy array to a pandas series. Fix: Make both variables the same data type, so they are both a numpy array or they are both a pandas series.

Steps to reproduce:

import numpy as np
import pandas as pd

x = np.array([1, 2, 3, 4, 5])