Skip to content

Instantly share code, notes, and snippets.

View nygeog's full-sized avatar

Danny S. nygeog

View GitHub Profile
@nygeog
nygeog / socrata-extract-latitude-longitude-w-pandas.py
Last active March 20, 2017 18:02
Socrata extract Latitude Longitude with Pandas
import pandas as pd
#https://data.medicare.gov/Hospital-Compare/Readmissions-and-Deaths-Hospital/ynj2-r877
inCSV = 'Readmissions_and_Deaths_-_Hospital.csv'
df = pd.read_csv(inCSV)
df.head(10)
df['latitude'] = (df.Location.str.split('(',1).str[1]).str.split(',',1).str[0]
import os
import zipfile
import glob
#EDIT ONLY THESE TWO VARIABLES
cdbU = <cartoDBusername>
cdbK = <cartoDBapikey>
shpFolder = 'data'
@nygeog
nygeog / nearJoin.py
Created October 9, 2015 14:12
ArcPy function near only includes FID or OBJECT ID information after its run, use this script to carry over the attributes of the near feature.
def nearJoin(inFeature,nearFeature,nearDistance,outFileLocation,outFeature):
### Normal Near Function doesn't carry over all the attributes of inFeature or nearFeature.
### To Do:
### Error handling in try: except: should handle OBJECTID vs. FID issues.
### Example:
### inF = wd+"input/fulcrum.gdb/street_segment_questions_v2_prj"
### nrF = wd+"processing/gar.gdb/gar_roads_ftl"
### nrD = "20 Meters"
### ouL = wd+"processing/fulcrum.gdb"
@nygeog
nygeog / test.js
Created February 27, 2015 01:25
Testing Gist
var test = 5;
@nygeog
nygeog / index.html
Last active August 29, 2015 14:15
mbostock's choropleth
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.states {
fill: none;
stroke: #fff;
stroke-linejoin: round;
}
@nygeog
nygeog / README.md
Created August 15, 2014 23:51 — forked from mbostock/.block
@nygeog
nygeog / index.html
Created August 12, 2014 18:31 — forked from dwtkns/index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.counties {
fill: none;
stroke: black;
opacity:0.2;
}
@nygeog
nygeog / pandas_slice_column.py
Created April 25, 2014 14:20
Pandas slice a column
geoidCalc = df['UID'].str[2:]
df['geoid'] = geoidCalc
@nygeog
nygeog / installpandasmacports
Created April 24, 2014 21:30
Install Pandas with MacPorts
sudo port install py27-pandas