Tutorial by Examples: df

Hashes can be freely converted to and from arrays. Converting a hash of key/value pairs into an array will produce an array containing nested arrays for pair: { :a => 1, :b => 2 }.to_a # => [[:a, 1], [:b, 2]] In the opposite direction a Hash can be created from an array of the same form...
Basics Anonymous functions are a powerful tool of the MATLAB language. They are functions that exist locally, that is: in the current workspace. However, they do not exist on the MATLAB path like a regular function would, e.g. in an m-file. That is why they are called anonymous, although they can h...
import os import glob import pandas as pd def get_merged_csv(flist, **kwargs): return pd.concat([pd.read_csv(f, **kwargs) for f in flist], ignore_index=True) path = 'C:/Users/csvfiles' fmask = os.path.join(path, '*mask*.csv') df = get_merged_csv(glob.glob(fmask), index_col=None, use...
You can also use the IEx (Interactive Elixir) shell to evaluate expressions and execute code. If you are on Linux or Mac, just type iex on your bash and press enter: $ iex If you are on a Windows machine, type: C:\ iex.bat Then you will enter into the IEx REPL (Read, Evaluate, Print, Loop),...
Suppose you have many changes in one or more files but from each file you only want to commit some of the changes, you can select the desired changes using: git add -p or git add -p [file] Each of your changes will be displayed individually, and for each change you will be prompted to choose...
Let's extend our template from above and include content from header.php and footer.php Including header: We will include header right after Template name comment There are two common ways to do this. Both are right and work same, it's just about your style and how code looks First way: <?ph...
Pattern matching can be used to deconstruct records. We illustrate this with a record type representing locations in a text file, e.g. the source code of a program. type location = { filename : string; line: int; column: int; offset: int; } A value x of type location can be deconstr...
We prepare a file called reverser.ml with the following contents: let acc = ref [] in try while true do acc := read_line () :: !acc; done with End_of_file -> print_string (String.concat "\n" !acc) We then compile our program using ...
This is MATLAB's long-winded way of saying that it cannot find the function that you're trying to call. There are a number of reasons you could get this error: That function was introduced after your current version of MATLAB The MATLAB online documentation provides a very nice feature which allow...

DFA

A DFA (Deterministic Finite Automaton) engine is driven by the input. Principle The algorithm scans through the input string once, and remembers all possible paths in the regex which could match. For instance, when an alternation is encountered in the pattern, two new paths are created and attem...
There are two ways to define functions with multiple parameters in F#, Curried functions and Tupled functions. let curriedAdd x y = x + y // Signature: x:int -> y:int -> int let tupledAdd (x, y) = x + y // Signature: x:int * y:int -> int All functions defined from outside F# (such as ...
.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...
import string import numpy as np import pandas as pd generate sample DF with various dtypes df = pd.DataFrame({ 'int32': np.random.randint(0, 10**6, 10), 'int64': np.random.randint(10**7, 10**9, 10).astype(np.int64)*10, 'float': np.random.rand(10), 'string': ...
ASDF provides the package ASDF-USER for developers to define their packages in.
Example: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <textarea id="content"></textarea> <input type="button" id="copy...
Get Focus Swift textField.becomeFirstResponder() Objective-C [textField becomeFirstResponder]; Resign Swift textField.resignFirstResponder() Objective-C [textField resignFirstResponder];
There are many cases when one has created an NSDate from only an hour and minute format, i.e: 08:12 that returns from a server as a String and you initiate an NSDate instance by these values only. The downside for this situation is that your NSDate is almost completely "naked" and what yo...
PBKDF2 ("Password-Based Key Derivation Function 2") is one of the recommended hash-functions for password-hashing. It is part of rfc-2898. .NET's Rfc2898DeriveBytes-Class is based upon HMACSHA1. using System.Security.Cryptography; ... public const int SALT_SIZE = 24; //...
Some formats can take additional parameters, such as the width of the formatted string, or the alignment: >>> '{:.>10}'.format('foo') '.......foo' Those can also be provided as parameters to format by nesting more {} inside the {}: >>> '{:.>{}}'.format('foo', 10) '.......
Early Bound (with a reference to Microsoft Scripting Runtime) Sub EnumerateFilesAndFolders( _ FolderPath As String, _ Optional MaxDepth As Long = -1, _ Optional CurrentDepth As Long = 0, _ Optional Indentation As Long = 2) Dim FSO As Scripting.FileSystemObject Set ...

Page 5 of 21