Skip to content

Instantly share code, notes, and snippets.

View mpiccorossi's full-sized avatar

Michael Piccorossi mpiccorossi

View GitHub Profile
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@kingkool68
kingkool68 / Pew Research Archive listing to CSV
Created April 21, 2014 18:58
Download the URL, title, and date for all of the posts on a given archive page URL such as http://www.pewresearch.org/category/publications/fact-tank/project/u-s-politics/2014/pages/all/ Copy and paste this into the Console of the developer tools.
jQuery( document ).ready( function($) {
var csv = "data:text/csv;charset=utf-8,";
var csvData = [];
$('#content .post').each(function() {
$this = $(this);
csvData.push( [this.href, $this.find('h2').text(), $this.find('.meta span:last-of-type').text() ] );
});
for( i=0; i < csvData.length; i++ ) {
var row = '"' + csvData[i].join('","') + '"';
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active March 25, 2024 19:45
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* 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();
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: