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)
#!/usr/bin/env ruby | |
# 1. export your RIL bookmarks | |
# 2. save this file to the same directory where your ril_export.html is | |
# 3. change username and password in the script bellow | |
# 4. run 'ruby ril_to_instapaper.rb' in terminal | |
require "cgi" | |
require "net/http" | |
require "net/https" |
# -*- coding: utf-8 -*- | |
""" | |
Go to Google Bookmarks: https://www.google.com/bookmarks/ | |
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en | |
After downloading the html file, run this script on it to generate a KML. | |
""" |
# requirements: python, virtualenv, pip | |
# | |
# create a virtualenv -- I keep all my virtualenvs in ~/virtualenv | |
virtualenv --distribute ~/virtualenv/coursera | |
# activate virtualenv | |
. ~/virtualenv/coursera/bin/activate | |
# get the coursera downloader tool and install requirements |
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
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)
#!/usr/bin/Rscript | |
if (!require(jsonlite, quietly = TRUE, warn.conflicts = FALSE)) { | |
stop("This program requires the `jsonlite` package. Please install it by running `install.packages('jsonlite')` in R and then try again.") | |
} | |
args <- commandArgs(trailingOnly = TRUE) | |
if (length(args) == 0) { | |
input <- readLines(file("stdin")) |