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)
pip show tensorflow | |
pip uninstall tensorflow | |
# Tensorflow 1.4 works only with Python 3.5 | |
# to install downgrade Python 3.6 to Python 3.5 in Anaconda | |
conda install python=3.5 | |
# now install tensorflow 1.4 | |
sudo apt-get install python3-pip python3-dev | |
pip install tensorflow |
import pandas as pd | |
import numpy as np | |
import seaborn as sns | |
from keras.layers import Dense | |
from keras.models import Model, Sequential | |
from keras import initializers | |
## ---------- Create our linear dataset --------------- | |
## Set the mean, standard deviation, and size of the dataset, respectively |
#' @name logger.setup | |
#' @export | |
#' @title Set Up Python-Style Logging | |
#' @param traceLog file name or full path where \code{logger.trace()} messages will be sent | |
#' @param debugLog file name or full path where \code{logger.debug()} messages will be sent | |
#' @param infoLog file name or full path where \code{logger.info()} messages will be sent | |
#' @param warnLog file name or full path where \code{logger.warn()} messages will be sent | |
#' @param errorLog file name or full path where \code{logger.error()} messages will be sent | |
#' @param fatalLog file name or full path where \code{logger.fatal()} messages will be sent | |
#' @return No return value. |
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list' | |
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 | |
gpg -a --export E084DAB9 | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -y install r-base libapparmor1 libcurl4-gnutls-dev libxml2-dev libssl-dev gdebi-core | |
sudo apt-get install libcairo2-dev | |
sudo apt-get install libxt-dev | |
sudo apt-get install git-core | |
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 |
#SOM example using wines data set | |
library(kohonen) | |
data(wines) | |
set.seed(7) | |
#create SOM grid | |
sommap <- som(scale(wines), grid = somgrid(2, 2, "hexagonal")) | |
## use hierarchical clustering to cluster the codebook vectors | |
groups<-3 |
# Claas Heuer, November 2015 | |
# install the package | |
install.packages("INLA", repos="http://www.math.ntnu.no/inla/R/stable") | |
# run a test on BGLR data | |
library(INLA) | |
library(BGLR) | |
data(wheat) |
SQL | |
Statements always end with a semi-colon ; | |
Statement breakdown: | |
CREATE TABLE table_name ( | |
column_1 data_type, | |
column_1 data_type | |
); |
## Load libraries | |
library(XML) | |
library(dplyr) | |
library(RCurl) | |
## Get the results for a specific term | |
scrape_term = function(search_term,npages){ | |
base_url = "http://scholar.google.com/scholar?" | |
search_string = paste0("q=",paste0(strsplit(search_term," ")[[1]],collapse="+")) | |
dat = data.frame(NA,nrow=10*npages,ncol=3) |
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)