Tutorial by Examples: and

Quintile analysis is a common framework for evaluating the efficacy of security factors. What is a factor A factor is a method for scoring/ranking sets of securities. For a particular point in time and for a particular set of securities, a factor can be represented as a pandas series where the in...
Increment by var a = 9, b = 3; b += a; b will now be 12 This is functionally the same as b = b + a; Decrement by var a = 9, b = 3; b -= a; b will now be 6 This is functionally the same as b = b - a; Multiply by var a = 5, b = 3; b *= a; b will now...
Show curl version: curl --version GET a remote resource and have it displayed in the terminal: curl http://stackoverflow.com GET a remote resource and save it in a local file: curl -o file https://stackoverflow.com Add headers to response: curl -i http://stackoverflow.com Output only...
RxSwift provides not only the ways to control your data, but to represent user actions in a reactive way also. RxCocoa contains everything you need. It wraps most of the UI components' properties into Observables, but not really. There are some upgraded Observables called ControlEvents (which repre...
While Runnable provides a means to wrap code to be executed in a different thread, it has a limitation in that it cannot return a result from the execution. The only way to get some return value from the execution of a Runnable is to assign the result to a variable accessible in a scope outside of t...
To make a jar, you need one or more class files. This should have a main method if it is to be run by a double click. For this example, we will use: import javax.swing.*; import java.awt.Container; public class HelloWorld { public static void main(String[] args) { JFrame f = ne...
Starting with the Support Library version 22.2.1, it's possible to show and hide a FloatingActionButton from scrolling behavior using a FloatingActionButton.Behavior sublclass that takes advantage of the show() and hide() methods. Note that this only works with a CoordinatorLayout in conjunction wi...
In R, data objects are manipulated using named data structures. The names of the objects might be called "variables" although that term does not have a specific meaning in the official R documentation. R names are case sensitive and may contain alphanumeric characters(a-z,A-z,0-9), the dot...
This is a mistake that causes real confusion for Java beginners, at least the first time that they do it. Instead of writing this: if (feeling == HAPPY) System.out.println("Smile"); else System.out.println("Frown"); they accidentally write this: if (feeling == HAP...
Undo Command:Descriptionuu,undoUndo the most recent change5uUndo the five most recent changes (use any number) Please be aware that in Vim, the 'most recent change' varies according to the mode you are in. If you enter Insert Mode (i) and type out an entire paragraph before dropping back to Normal...
In Vim, these operations are handled differently from what you might be used to in almost any other modern editor or word processor (Ctrl-C, Ctrl-X, Ctrl-V). To understand, you need to know a little about registers and motions. Note: this section will not cover Visual Mode copying and cutting or ra...
Unlike a parallel for-loop (parfor), which takes the iterations of a loop and distributes them among multiple threads, a single program, multiple data (spmd) statement takes a series of commands and distributes them to all the threads, so that each thread performs the command and stores the results....
Using Alternatives Many Linux distributions use the alternatives command for switching between different versions of a command. You can use this for switching between different versions of Java installed on a machine. In a command shell, set $JDK to the pathname of a newly installed JDK; e.g....
Given a DataFrame with MultiIndex columns # build an example DataFrame midx = pd.MultiIndex(levels=[['zero', 'one'], ['x','y']], labels=[[1,1,0,],[1,0,1,]]) df = pd.DataFrame(np.random.randn(2,3), columns=midx) In [2]: df Out[2]: one zero y x ...
Start with a standard DataFrame df = pd.DataFrame(np.random.randn(2,3), columns=['a','b','c']) In [91]: df Out[91]: a b c 0 -0.911752 -1.405419 -0.978419 1 0.603888 -1.187064 -0.035883 Now to change to MultiIndex, create a MultiIndex object and assign it to df....
Use .get(key) to get value by key and .set(key, value) to assign a value to a key. If the element with the specified key doesn't exist in the map, .get() returns undefined. .set() method returns the map object, so you can chain .set() calls. const map = new Map(); console.log(map.get(1)); // und...
Building project dependencies can sometimes be a tedious task. Instead of publishing a package version to NPM and installing the dependency to test the changes, use npm link. npm link creates a symlink so the latest code can be tested in a local environment. This makes testing global tools and proje...
The %timeit magic runs the given code many times, then returns the speed of the fastest result. In [1]: %timeit sum(range(100000)) 100 loops, best of 3: 2.91 ms per loop The %%timeit cell magic can be used to time blocks of code. In [2]: %%timeit ...: a = 0 ...: for i in range(100000):...
R provides two additional looping constructs, while and repeat, which are typically used in situations where the number of iterations required is indeterminate. The while loop The general form of a while loop is as follows, while (condition) { ## do something ## in loop body } whe...
For a class Person like: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } var person1 = new Person { Name = "Jon", Age = 20, Clothes = "some clothes" }; var person2 = new Person { Name ...

Page 82 of 153