Tutorial by Examples: is

To view all elements in the index change the print options that “sparsifies” the display of the MultiIndex. pd.set_option('display.multi_sparse', False) df.groupby(['A','B']).mean() # Output: # C # A B # a 1 107 # a 2 102 # a 3 115 # b 5 92 # b 8 98 # c 2 87 # c 4 104 #...
<?php /* this example is based on the advanced template * This file is located in * backend/views/layouts/main.php */ use yii\helpers\Html; // here the asset is registered use cinghie\adminlte\AdminLTEAsset; AdminLTEAsset::register($this); ?> <?php $this->beginPage...
<?php /** * This file is the Asset Bundle File located in * vendor/cinghie/yii2-admin-lte/AdminLTEAsset.php * @copyright Copyright © Gogodigital Srls * @company Gogodigital Srls - Wide ICT Solutions * @website http://www.gogodigital.it * @github https://github.com/cinghie/yii...
A linked list is either: the empty list, represented by None, or a node that contains a cargo object and a reference to a linked list. #! /usr/bin/env python class Node: def __init__(self, cargo=None, next=None): self.car = cargo self.cdr = next d...
Delegate: UISearchBarDelegate, UISearchControllerDelegate, UISearchBarDelegate @property (strong, nonatomic) UISearchController *searchController; - (void)searchBarConfiguration { self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchC...
Reading the content of an InputStream as a byte array: // Reading from a file try (InputStream in = new FileInputStream("in.dat")) { byte[] content = ByteStreams.toByteArray(in); // do something with content } Copying an InputStream to an OutputStream: // Copying the content f...
#include <omp.h> #include <unistd.h> #include <iostream> #include <list> static void processElement (unsigned n) { // Tell who am I. The #pragma omp critical ensures that // only one thread sends data to std::cout #pragma omp critical std::cout <...
To get a list of the processes running in the current terminal, you can use ps : $ sleep 1000 & $ ps -opid,comm PID COMMAND 1000 sh 1001 sleep 1002 ps To kill a running process, use kill with the process ID (PID) indicated by ps: $ kill 1001 $ ps -opid,comm PID COMMAND 1000 sh...
Reading the content of a Reader as a String: // Reading from a file try (Reader reader = new FileReader("in.txt")) { String content = CharStreams.toString(reader); // do something with content } Reading the content of a Reader as a list of line contents: try (Reader reader = n...
Doubly Linked Lists are a type of linked list. A doubly linked list's nodes have two "pointers" to other nodes, "next" and "previous." It is called a double linked list because each node only has two "pointers" to other nodes. A doubly linked list may have a h...
You can use the IFA for measuring ad clicks and the IFV for measuring app installs. IFA has built-in privacy mechanisms that make it perfect for advertising. In contrast, the IFV is for developers to use internally to measure users who install their apps. IFA ASIdentifierManager class pr...
This example uses the map format introduced in Erlang/OTP 18.0. %% A module implementing a supervisor usually has a name ending with `_sup`. -module(my_sup). -behaviour(supervisor). %% API exports -export([start_link/0]). %% Behaviour exports -export([init/1]). start_link() -> ...
We initialize the data: [X,Y] = meshgrid(1:2:10); Z = X.*cos(Y) - Y.*sin(X); The surface looks like the following. Now we set the points where we want to interpolate: [Vx,Vy] = meshgrid(1:0.25:10); We now can perform nearest interpolation, Vz = interp2(X,Y,Z,Vx,Vy,'nearest'); line...
We will use the following data: x = 1:5:50; y = randi([-10 10],1,10); Hereby x and y are the coordinates of the data points and z are the points we need information about. z = 0:0.25:50; One way to find the y-values of z is piecewise linear interpolation. z_y = interp1(x,y,z,'linear'); ...
Sometimes it may be required to find out which directory consuming how much disk space especially when you are used df -h and realized your available disk space is low. du: du command summarizes disk usage of the set of FILEs, recursively for directories. It's often uses with -sh option: -s, --s...
Installation Additional dependencies are required for Redis support. Install both Celery and the dependencies in one go using the celery[redis] bundle: $ pip install -U celery[redis] Configuration Configure the location of your Redis database: BROKER_URL = 'redis://localhost:6379/0' The UR...
To list available login shells : cat /etc/shells Example: $ cat /etc/shells # /etc/shells: valid login shells /bin/sh /bin/dash /bin/bash /bin/rbash
GNU make This pairmap function takes three arguments: A function name First space-separated list Second space-separated list For each zipped tuple in the lists it will call the function with the following arguments: Tuple element from the first list Tuple element from the second list ...
The following is the list of all the data structures supported by Redis: Binary-safe strings Lists: collections of string elements sorted according to the order of insertion. Sets: collections of unique, unsorted string elements. Sorted sets: similar to Sets but where every string element is a...
A decision tree is a classifier which uses a sequence of verbose rules (like a>7) which can be easily understood. The example below trains a decision tree classifier using three feature vectors of length 3, and then predicts the result for a so far unknown fourth feature vector, the so called te...

Page 74 of 109