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)
| I remember very clear I cry when I finish volume 3 of Knuth. | |
| % | |
| I am work on CSS SQL. | |
| % | |
| First sign of depression in devops is denial: you start of ignore Nagios alert. | |
| % | |
| In devops language is not success unless is another language++. | |
| % | |
| In devops you are addict to graph if first thought after orgasm is send duration and intensity to Graphite. | |
| % |
| import pandas as pd | |
| import numpy as np | |
| from sklearn.feature_extraction import DictVectorizer | |
| def encode_onehot(df, cols): | |
| """ | |
| One-hot encoding is applied to columns specified in a pandas DataFrame. | |
| Modified from: https://gist.github.com/kljensen/5452382 | |
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)
| import sys | |
| from pyspark.context import SparkContext | |
| from numpy import array, random as np_random | |
| from sklearn import linear_model as lm | |
| from sklearn.base import copy | |
| N = 10000 # Number of data points | |
| D = 10 # Numer of dimensions | |
| ITERATIONS = 5 |