Skip to content

Instantly share code, notes, and snippets.

View nygeog's full-sized avatar

Danny S. nygeog

View GitHub Profile
@nygeog
nygeog / replace_missing_with_zero.py
Last active August 29, 2015 14:00
Pandas: Replace misssing data with zero
#pandas replace all missing values 1,,,9 with zero's 1,0,0,9
df = df.fillna(0)
@nygeog
nygeog / installpandasmacports
Created April 24, 2014 21:30
Install Pandas with MacPorts
sudo port install py27-pandas
@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 / 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 / README.md
Created August 15, 2014 23:51 — forked from mbostock/.block
@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 / test.js
Created February 27, 2015 01:25
Testing Gist
var test = 5;
@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"
import os
import zipfile
import glob
#EDIT ONLY THESE TWO VARIABLES
cdbU = <cartoDBusername>
cdbK = <cartoDBapikey>
shpFolder = 'data'