This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# added by Anaconda3 2019.10 installer | |
# >>> conda init >>> | |
# !! Contents within this block are managed by 'conda init' !! | |
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/{...username...}/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)" | |
if [ $? -eq 0 ]; then | |
\eval "$__conda_setup" | |
else | |
if [ -f "/Users/{...username...}/opt/anaconda3/etc/profile.d/conda.sh" ]; then | |
. "/Users/{...username...}/opt/anaconda3/etc/profile.d/conda.sh" | |
CONDA_CHANGEPS1=false conda activate base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from geopandas import GeoDataFrame | |
from shapely.geometry import Point | |
import fiona | |
df = pd.read_csv('data.csv') | |
geometry = [Point(xy) for xy in zip(df.x, df.y)] | |
crs = {'init': 'epsg:2263'} #http://www.spatialreference.org/ref/epsg/2263/ | |
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cartodb import CartoDBAPIKey, CartoDBException, FileImport | |
from _secret_info import cartodb_domain, API_KEY | |
cl = CartoDBAPIKey(API_KEY, cartodb_domain) | |
fi = FileImport('nyctrees2015.csv', cl, create_vis='true', privacy='public') # Import csv file, set privacy as 'link' and create a default viz | |
fi.run() #https://github.com/CartoDB/cartodb-python | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
inFileName = 'data/cartojsontest1.carto.json' | |
ouFileName = 'data/cartojsontest1_change_zoom10.carto.json' | |
newMapName = 'THIS IS A TEST10' | |
zoomLevel = 12 | |
lat = '40.7127' | |
lng = '-75.0059' | |
oldDatasetName = 'infogroup_bus_2012_is_mcdonalds' | |
newDatasetName = 'infogroup_bus_2012_like_exxon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def oneTest(): | |
return 'so' | |
def openJSON(inFile): | |
with open(inFile) as json_data: | |
data = json.load(json_data) | |
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE table_name ADD COLUMN torque_class INTEGER; | |
UPDATE table_name SET torque_class = ROUND(((input_col - (SELECT MIN(input_col) FROM table_name)) / (( (SELECT MAX(input_col) FROM table_name) - (SELECT MIN(input_col) FROM table_name))) * 255)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
import csv | |
import pandas as pd | |
import numpy as np | |
import decimal | |
D = decimal.Decimal | |
url = "https://www.wework.com/locations/all" | |
data = urllib2.urlopen(url).read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df['col'] = ((((df['col']-df['col'].min()) / (df['col'].max() - df['col'].min()))*255).round()).astype(int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Map Title</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<link rel="shortcut icon" href="https://cartodb.com/assets/favicon.ico" /> | |
<style> | |
html, body, #map { | |
height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE tablename ADD COLUMN new_col TEXT | |
UPDATE tablename SET new_col = to_char(old_col, '9,999,999') |
NewerOlder