Skip to content

Instantly share code, notes, and snippets.

View asemler's full-sized avatar

Angie Semler asemler

View GitHub Profile
@asemler
asemler / useful_pandas_snippets.md
Created November 6, 2022 16:17 — forked from bsweger/useful_pandas_snippets.md
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)

{ "results": [
{ "id": 1, "name": "apple"},
{ "id": 2, "name": "angel"},
{ "id": 3, "name": "can"},
{ "id": 4, "name": "cat"},
{ "id": 5, "name": "data"},
{ "id": 6, "name": "dog"},
{ "id": 7, "name": "gelatinous"},
{ "id": 8, "name": "lateral"},
{ "id": 9, "name": "test"},
function getSize(method) {
return document.documentElement[method] || document.body[method];
}
getSize("scrollTop");
kill -9 $(ps aux | grep harmony | grep -v grep | awk '{print $2}')
input:disabled::-webkit-input-placeholder { /* WebKit browsers */
color: #fff;
}
input:disabled:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #fff;
}
input:disabled::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #fff;
}
input:disabled:-ms-input-placeholder { /* Internet Explorer 10+ */
@asemler
asemler / init-youtube.txt
Last active January 7, 2016 17:38
init-youtube
var setupYouTubeAPI = function() {
// Load the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = 'https://www.youtube.com/player_api';
// inject script to DOM
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// creates a global "addWheelListener" method
// example: addWheelListener( elem, function( e ) { console.log( e.deltaY ); e.preventDefault(); } );
(function(window,document) {
var prefix = "", _addEventListener, support;
// detect event model
if ( window.addEventListener ) {
_addEventListener = "addEventListener";
} else {
@asemler
asemler / index.html
Last active December 16, 2015 18:50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/plugins/animation.gsap.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/plugins/animation.gsap.min.js"></script>
@asemler
asemler / boilerplate-scrollmagic.html
Last active January 11, 2016 19:43
Skeleton Scrollmagic Scratchpad using CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/plugins/animation.gsap.min.js"></script>