Tutorial by Examples: st

import pandas as pd import numpy as np np.random.seed(0) tuples = list(zip(*[['bar', 'bar', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two','one', 'two']])) idx = pd.MultiIndex.from_tuples(tuples, names=['first', 'second']) df = pd.DataFrame(np.random.randn(6, ...
use std::error::Error; use std::fmt; use std::convert::From; use std::io::Error as IoError; use std::str::Utf8Error; #[derive(Debug)] // Allow the use of "{:?}" format specifier enum CustomError { Io(IoError), Utf8(Utf8Error), Other, } // Allow the use of "{...
data.table offers a wide range of possibilities to reshape your data both efficiently and easily For instance, while reshaping from long to wide you can both pass several variables into the value.var and into the fun.aggregate parameters at the same time library(data.table) #v>=1.9.6 DT <- ...
struct Struct<'a> { x: &'a u32, } This specifies that any given instance of Struct has lifetime 'a, and the &u32 stored in x must have a lifetime of at least 'a.
A Service is a component which runs in the background (on the UI thread) without direct interaction with the user. An unbound Service is just started, and is not bound to the lifecycle of any Activity. To start a Service you can do as shown in the example below: // This Intent will be used to star...
1) BASIC SIMPLE WAY Database-driven applications often need data pre-seeded into the system for testing and demo purposes. To make such data, first create the seeder class ProductTableSeeder use Faker\Factory as Faker; use App\Product; class ProductTableSeeder extends DatabaseSeeder { pub...
You can download Mercurial from the project's website, and there are graphical utilities for Windows, Linux and OSX if you'd prefer that to a command line interface. Most Unix package managers include Mercurial, for example on Debian/Ubuntu: $ apt-get install mercurial You can verify Mercurial i...
Install-Package NUnit This package includes all assemblies needed to create unit tests. Tests can be executed using one of the following methods: Visual Studio Unit Test Window Console runner Third party runner that supports NUnit 3 Visual Studio Unit Test Window To execute tests using ...
The Python Standard Library includes an interactive debugging library called pdb. pdb has extensive capabilities, the most commonly used being the ability to 'step-through' a program. To immediately enter into step-through debugging use: python -m pdb <my_file.py> This will start the debu...
import pandas as pd df = pd.DataFrame({'Sex': ['M', 'M', 'F', 'M', 'F', 'F', 'M', 'M', 'F', 'F'], 'Age': [20, 19, 17, 35, 22, 22, 12, 15, 17, 22], 'Heart Disease': ['Y', 'N', 'Y', 'N', 'N', 'Y', 'N', 'Y', 'N', 'Y']}) df Age Heart Disease Sex 0 20 ...
Responses can be written to a http.ResponseWriter using templates in Go. This proves as a handy tool if you wish to create dynamic pages. (To learn how Templates work in Go, please visit the Go Templates Documentation page.) Continuing with a simple example to utilise the html/template to respond ...
If the compiler can infer that an object can't be null at a certain point, you don't have to use the special operators anymore: var string: String? = "Hello!" print(string.length) // Compile error if(string != null) { // The compiler now knows that string can't be null print(...
In order to install PostgreSQL on OSX, you need to know which versions are currently supported. Use this command to see what versions you have available. sudo port list | grep "^postgresql[[:digit:]]\{2\}[[:space:]]" You should get a list that looks something like the following: post...
DynamoDB is a fully managed service provided by AWS. It does not need to be installed or configured. AWS is responsible for all administrative burdens of operating, scalling and backup/restore of the distributed database.
Use TO_CHAR( date [, format_model [, nls_params]] ): (Note: if a format model is not provided then the NLS_DATE_FORMAT session parameter will be used as the default format model; this can be different for every session so should not be relied on. It is good practice to always specify the format mod...
A rank-1 array value can be created using an array constructor, with the syntax (/ ... /) [ ... ] The form [...] was introduced in Fortran 2003 and is generally regarded as clearer to read, especially in complex expressions. This form is used exclusively in this example. The values featuring ...
A method defined in an interface is by default public abstract. When an abstract class implements an interface, any methods which are defined in the interface do not have to be implemented by the abstract class. This is because a class that is declared abstract can contain abstract method declaratio...
Sometimes developers write some code that desires access to stage, or Flash stage, to add listeners. It can work for the first time, then all of a sudden fail to work and produce the error 1009. The code in question can even be on the timeline, as it's the first initiative to add code there, and man...
function listener(e:Event):void { var m:MovieClip=e.target as MovieClip; m.x++; } If such a listener is attached to an object that's not a MovieClip descendant (for example, a Sprite), the typecast will fail, and any subsequent operations with its result will throw the 1009 error.
var a:Object; trace(a); // null trace(a.b); // Error 1009 Here, an object reference is declared, but is never assigned a value, be it with new or assignment of a non-null value. Requesting its properties or method results in a 1009 error.

Page 71 of 369