A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
| LAcode | geog_LA | Ecode | |
|---|---|---|---|
| E06000001 | Hartlepool | E0701 | |
| E06000002 | Middlesbrough | E0702 | |
| E06000003 | Redcar and Cleveland | E0703 | |
| E06000004 | Stockton-on-Tees | E0704 | |
| E06000005 | Darlington | E1301 | |
| E06000006 | Halton | E0601 | |
| E06000007 | Warrington | E0602 | |
| E06000008 | Blackburn with Darwen | E2301 | |
| E06000009 | Blackpool | E2302 |
| # data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat | |
| # Originally seen at http://spatial.ly/2014/08/population-lines/ | |
| # So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess, | |
| # and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after | |
| # @hadleywickham pointed that out. Also, switched from geom_segment to geom_line. | |
| # The result of the code below can be seen at http://imgur.com/ob8c8ph | |
| library(tidyverse) |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)| # fixed version of http://altons.github.io/python/2012/12/01/converting-northing-and-easting-to-latitude-and-longitude/ | |
| # - filenames | |
| # - data type (pyproj transform doesn't like pandas series) | |
| import os | |
| import pandas as pd | |
| import pyproj | |
| import re | |
| listfiles = os.listdir("codepo/Data/CSV") | |
| pieces = [] |
| /* | |
| * script to export data in all sheets in the current spreadsheet as individual csv files | |
| * files will be named according to the name of the sheet | |
| * author: Michael Derazon | |
| */ | |
| function onOpen() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var csvMenuEntries = [{name: "export as csv files", functionName: "saveAsCSV"}]; | |
| ss.addMenu("csv", csvMenuEntries); |
Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.
| RAL,RGB,HEX,CMYK,LRV,English,German,French,Spanish,Italian,Dutch | |
| RAL 1000,205-186-136,#CDBA88,0-9-34-20,51.79,Green beige,Grünbeige,Beige vert,Beige verdoso,Beige verdastro,Groenbeige | |
| RAL 1001,208-176-132,#D0B084,0-15-37-18,48.09,Beige,Beige,Beige,Beige,Beige,Beige | |
| RAL 1002,210-170-109,#D2AA6D,0-19-48-18,45.07,Sand yellow,Sandgelb,Jaune sable,Amarillo arena,Giallo sabbia,Zandgeel | |
| RAL 1003,249-169-0,#F9A900,0-32-100-2,49.05,Signal yellow,Signalgelb,Jaune de sécurité,Amarillo señales,Giallo segnale,Signaalgeel | |
| RAL 1004,228-158-0,#E49E00,0-31-100-11,42.13,Golden yellow,Goldgelb,Jaune or,Amarillo oro,Giallo oro,Goudgeel | |
| RAL 1005,203-143-0,#CB8F00,0-30-100-20,34.15,Honey yellow,Honiggelb,Jaune miel,Amarillo miel,Giallo miele,Honinggeel | |
| RAL 1006,225-144-0,#E19000,0-36-100-12,37.45,Maize yellow,Maisgelb,Jaune maïs,Amarillo maíz,Giallo polenta,Maisgeel | |
| RAL 1007,232-140-0,#E88C00,0-40-100-9,37.63,Daffodil yellow,Narzissengelb,Jaune narcisse,Amarillo narciso,Giallo narciso,Narcissengeel | |
| RAL 1011,175-128-80,#AF8050,0-27 |
| <!-- | |
| Use this snippet to add a google map location chooser to your form | |
| Step 1: Get a google map api key and insert it in the first javascript tag | |
| Step 2: In your html form, create two hidden elements, one for latitude, and one for longitude. Give the elements ids and set the LATITUDE_ELEMENT_ID and LONGITUDE_ELEMENT_ID to the appropriate variables | |
| Done! | |
| --> |