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)
| /* Exercise: Loops and Functions #43 */ | |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func Sqrt(x float64) float64 { | |
| z := float64(2.) |
| <# | |
| .SYNOPSIS | |
| Adds an XML fragment to an XmlNode | |
| .DESCRIPTION | |
| Adds an XML fragment to an XmlNode | |
| .NOTES | |
| Author : Thomas Freudenberg - [email protected] | |
| import networkx as nx | |
| import numpy as np | |
| from nltk.tokenize.punkt import PunktSentenceTokenizer | |
| from sklearn.feature_extraction.text import TfidfTransformer, CountVectorizer | |
| def textrank(document): | |
| sentence_tokenizer = PunktSentenceTokenizer() | |
| sentences = sentence_tokenizer.tokenize(document) | |
| ################### | |
| # compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.pdb | |
| *.dll.config | |
| *.cache |
| import sys | |
| import subprocess | |
| def copy(s): | |
| if sys.platform == 'win32' or sys.platform == 'cygwin': | |
| subprocess.Popen(['clip'], stdin=subprocess.PIPE).communicate(s) | |
| else: | |
| raise Exception('Platform not supported') | |
| ''' |
| """ | |
| Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ] | |
| Modified from remove_output by Minrk | |
| """ | |
| import sys | |
| import io | |
| import os | |
| from IPython.nbformat.current import read, write |
| /* Drop all non-system stored procs */ | |
| DECLARE @name VARCHAR(128) | |
| DECLARE @SQL VARCHAR(254) | |
| SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
| WHILE @name is not null | |
| BEGIN | |
| SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
| EXEC (@SQL) |
| # (C) Mathieu Blondel, November 2013 | |
| # License: BSD 3 clause | |
| import numpy as np | |
| def ranking_precision_score(y_true, y_score, k=10): | |
| """Precision at rank k | |
| Parameters |
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)
| '''This script goes along the blog post | |
| "Building powerful image classification models using very little data" | |
| from blog.keras.io. | |
| It uses data that can be downloaded at: | |
| https://www.kaggle.com/c/dogs-vs-cats/data | |
| In our setup, we: | |
| - created a data/ folder | |
| - created train/ and validation/ subfolders inside data/ | |
| - created cats/ and dogs/ subfolders inside train/ and validation/ | |
| - put the cat pictures index 0-999 in data/train/cats |