Tutorial by Examples: c

rvest is a package for web scraping and parsing by Hadley Wickham inspired by Python's Beautiful Soup. It leverages Hadley's xml2 package's libxml2 bindings for HTML parsing. As part of the tidyverse, rvest is piped. It uses xml2::read_html to scrape the HTML of a webpage, which can then be sub...
The r method implicitly provided via scala.collection.immutable.StringOps produces an instance of scala.util.matching.Regex from the subject string. Scala's triple-quoted string syntax is useful here, as you do not have to escape backslashes as you would in Java: val r0: Regex = """(...
Comparing string in a case insensitive way seems like something that's trivial, but it's not. This section only considers unicode strings (the default in Python 3). Note that Python 2 may have subtle weaknesses relative to Python 3 - the later's unicode handling is much more complete. The first thi...
Logistic regression is a particular case of the generalized linear model, used to model dichotomous outcomes (probit and complementary log-log models are closely related). The name comes from the link function used, the logit or log-odds function. The inverse function of the logit is called the lo...
.message color: white .message-important @extend .message background-color: red This will take all of the styles from .message and add them to .message-important. It generates the following CSS: .message, .message-important { color: white; } .message-important { background-...
.message color: white .important background-color: red .message-important @extend .message, .important In the above code @extend is used in one line to add multiple classes' code to .message-important, however, it is possible to use one extend per line like this: .message-importan...
.message color: white background: black .message-important @extend .message font-weight: bold .message-error @extend .message-important font-style: italic This code causes .message-error to extend from .message-important, which means that it will contain code from both .me...
If the file does not contain a header row, File: 1;str_data;12;1.4 3;str_data;22;42.33 4;str_data;2;3.44 2;str_data;43;43.34 7; str_data; 25; 23.32 you can use the keyword names to provide column names: df = pandas.read_csv('data_file.csv', sep=';', index_col=0, ski...
generate sample data frames: In [57]: df3 = pd.DataFrame({'col1':[211,212,213], 'col2': [221,222,223]}) In [58]: df1 = pd.DataFrame({'col1':[11,12,13], 'col2': [21,22,23]}) In [59]: df2 = pd.DataFrame({'col1':[111,112,113], 'col2': [121,122,123]}) In [60]: df3 = pd.DataFrame({'col1':[211,2...
import os, time import pyodbc import pandas.io.sql as pdsql def todf(dsn='yourdsn', uid=None, pwd=None, query=None, params=None): ''' if `query` is not an actual query but rather a path to a text file containing a query, read it in instead ''' if query.endswith('.sql') and o...
Functions remember the lexical scope they where defined in. Because of this, we can enclose a lambda in a let to define closures. (defvar *counter* (let ((count 0)) (lambda () (incf count)))) (funcall *counter*) ;; => 1 (funcall *counter*) ;; = 2 In the example above,...
The pattern matching library trivia provides a system trivia.ppcre that allows captured groups to be bound through pattern matching (trivia:match "John Doe" ((trivia.ppcre:ppcre "(.*)\\W+(.*)" first-name last-name) (list :first-name first-name :last-name last-name))) ;...
redis-cli ping This should return PONG
Common Lisp has a standard, which was initially published in 1994 as an ANSI standard. The Common Lisp HyperSpec, short CLHS, provided by LispWorks is an often used HTML documentation, which is derived from the standard document. The HyperSpec can also be downloaded and locally used. Common Lisp d...
The ANSI CL standard uses an extended EBNF syntax notation. The documentation duplicated on Stackoverflow should use the same syntax notation to reduce confusion. Example: specialized-lambda-list::= ({var | (var parameter-specializer-name)}* [&optional {var | (var [initform [supp...
Given this object: var obj = { a: "hello", b: "this is", c: "javascript!", }; You can convert its values to an array by doing: var array = Object.keys(obj) .map(function(key) { return obj[key]; }); console.log(array); // [&quot...
Lets say we have a class as (defclass person () (name email age)) To obtain the names of the slots of the class we use the function class-slots. This can be found in the closer-mop package, provided by the closer-mop system. To load it the running lisp image we use (ql:quickload :closer-mop)....
CREATE DATABASE stackoverflow; USE stackoverflow; Create table stack( id_user int NOT NULL, username varchar(30) NOT NULL, password varchar(30) NOT NULL ); ALTER TABLE stack ADD COLUMN submit date NOT NULL; -- add new column ALTER TABLE stack DROP COLUMN submit; -- drop col...
itertools.combinations will return a generator of the k-combination sequence of a list. In other words: It will return a generator of tuples of all the possible k-wise combinations of the input list. For Example: If you have a list: a = [1,2,3,4,5] b = list(itertools.combinations(a, 2)) print ...
import java.io.*; import java.net.Socket; public class Main { public static void main(String[] args) throws IOException {//We don't handle Exceptions in this example //Open a socket to stackoverflow.com, port 80 Socket socket = new Socket("stackoverflow.com",8...

Page 228 of 826