Skip to content

Instantly share code, notes, and 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)

@kalligator
kalligator / cdn.conf
Created March 29, 2021 20:47 — forked from tx2z/cdn.conf
Configure subdomain as "CDN" in NGINX (+ Wordpress & W3 Total Cache configuration) - http://jesus.perezpaz.es/2014/02/configure-subdomain-as-cdn-in-nginx-wordpress-w3-total-cache-configurations
# -------------------------------------------------
# CDN CONFIGURATION
# -------------------------------------------------
# Show "Not Found" 404 errors in place of other NGINX errors
error_page 403 /404;
error_page 404 /404;
error_page 405 /404;
error_page 500 501 502 503 504 /404;
location /404 {
@kalligator
kalligator / wpdb_default_tables.sql
Created July 22, 2020 04:55 — forked from rnagle/wpdb_default_tables.sql
Default WordPress Database Table Create Statements
DROP TABLE IF EXISTS wp_users;
CREATE TABLE wp_users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(64) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(60) NOT NULL default '',
@kalligator
kalligator / apply-pantheon-terminal-color.sh
Created November 20, 2019 16:47 — forked from trongthanh/apply-pantheon-terminal-color.sh
Apply custom color theme for Pantheon Terminal ver 5.3+
#!/bin/bash
# Apply custom color theme for Pantheon Terminal ver 5.3+
# 1) preview and choose a color theme from http://mayccoll.github.io/Gogh/
# 2) open the equivalent bash file containing the color values at https://github.com/Mayccoll/Gogh/tree/master/themes
# 3) concatenate all 16 colors at the top with colon ":", then replace it at the palette variable below
# 4) replace color for foreground, background, and cursor; choose whether your theme is light or dark
# 5) sudo apt-get install dconf-tools
# 6) execute this script