Skip to content

Instantly share code, notes, and snippets.

View ethanwhite's full-sized avatar

Ethan White ethanwhite

View GitHub Profile
@ethanwhite
ethanwhite / python_excel_dates.ipynb
Last active August 29, 2015 13:58
Testing the Excel date import problem in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Benefits of version control

  • Track changes on steroids

    • Tracks every change ever made in groups called commits
    • Every commit stores the full state of all of your files at that time
    • Never lose anything
    • Easily unbreak your code/data/manuscript
    • No more file name changes
  • Collaboration

@ethanwhite
ethanwhite / read_csv_high_decimal_places.md
Last active August 29, 2015 14:02
read.csv() with too many decimal places

It appears that read.csv() converts floats to factors if they have a large number of decimal places.

Data files

test_works.csv:

a,b
1.255,2.993
1.834,2.555
@ethanwhite
ethanwhite / species_regex.py
Created November 3, 2014 22:52
regex example
import re
inputfile = open('wikipedia_rodents.txt', 'r')
def get_species(inputstring):
species_regexs = "([A-Z][a-z]+ [a-z]+)"
species_search = re.search(species_re, inputstring)
if species_search:
return species_search.group(1)
@ethanwhite
ethanwhite / setup.py
Created November 19, 2014 22:15
Simple example of setup.py
from setuptools import setup
setup(
name="UltimateAnswer",
version="0.1",
entry_points = {'console_scripts': ['ult-ans = ultimate_answer:main']},
py_modules = ['ultimate_answer']
)
@ethanwhite
ethanwhite / gdal_examp.py
Created November 20, 2014 01:37
Minimal case for issue with netcdf files and gdal on Anaconda
from osgeo import gdal
gdal.AllRegister()
driver = gdal.GetDriverByName("netCDF")
gdal.Open("test.nc")

Keybase proof

I hereby claim:

  • I am ethanwhite on github.
  • I am ethanwhite (https://keybase.io/ethanwhite) on keybase.
  • I have a public key whose fingerprint is C8A0 514B EB42 6936 FB37 2900 5882 6D7C E10D CD71

To claim this, I am signing this object:

@ethanwhite
ethanwhite / gource-multiple-repositories.sh
Created May 2, 2012 15:14 — forked from anonymous/gource-multiple-repositories.sh
Generates gource video out of multiple repositories.
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
i=0
for repo in $*; do
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
logfile="$(mktemp /tmp/gource.XXXXXX)"
@ethanwhite
ethanwhite / plot_data_w_pandas.py
Created May 28, 2012 03:20
A simpler version of Michael Hansen's temperature trend example using Pandas
"""Trying Michael Hansen's temperature trend example using Pandas
The original example, without Pandas, is available at:
http://software-carpentry.org/2012/05/an-exercise-with-matplotlib-and-numpy/
"""
import os
import pandas
import numpy as np
import matplotlib.pyplot as pyplot
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.