Tutorial by Examples

import pandas as pd import io temp=u"""index; header1; header2; header3 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""" #after testing replace io.StringIO(temp) to filename df = pd.read_csv(io....
import pandas as pd import numpy as np np.random.seed(0) rng = pd.date_range('2015-02-24', periods=5, freq='T') s = pd.Series(np.random.randn(len(rng)), index=rng) print (s) 2015-02-24 00:00:00 1.764052 2015-02-24 00:01:00 0.400157 2015-02-24 00:02:00 0.978738 2015-02-24 00:0...
Step 1. Install Java 7 or 8 Step 2. Download Apache Kafka at: http://kafka.apache.org/downloads.html For example, we will try download Apache Kafka 0.10.0.0 Step 3. Extract the compressed file. On Linux: tar -xzf kafka_2.11-0.10.0.0.tgz On Window: Right click --> Extract here Step 4. Sta...
Analog to get a collection for a Stream by collect() an array can be obtained by the Stream.toArray() method: List<String> fruits = Arrays.asList("apple", "banana", "pear", "kiwi", "orange"); String[] filteredFruits = fruits.stream() ....
A common pitfall of child classes is that, if your parent and child both contain a constructor(__construct()) method, only the child class constructor will run. There may be occasions where you need to run the parent __construct() method from it's child. If you need to do that, then you will need to...
Instructions on installing Laravel 5.1 on a Linux/Mac/Unix Machine. Before initiating the installation, check if the following requirements are met: PHP >= 5.5.9 OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension Let's begin the installation: Inst...
To support a given application, you often create a new role and database to match. The shell commands to run would be these: $ createuser -P blogger Enter password for the new role: ******** Enter it again: ******** $ createdb -O blogger blogger This assumes that pg_hba.conf has been prope...
Table file with header, footer, row names, and index column: file: table.txt This is a header that discusses the table file to show space in a generic table file index name occupation 1 Alice Salesman 2 Bob Engineer 3 Charlie Janitor This is a footer becaus...
Introduction The BufferedReader class is a wrapper for other Reader classes that serves two main purposes: A BufferedReader provides buffering for the wrapped Reader. This allows an application to read characters one at a time without undue I/O overheads. A BufferedReader provides functi...
If we know the length of the string, we can use a for loop to iterate over its characters: char * string = "hello world"; /* This 11 chars long, excluding the 0-terminator. */ size_t i = 0; for (; i < 11; i++) { printf("%c\n", string[i]); /* Print each character of ...
In C, a string is a sequence of characters that is terminated by a null character ('\0'). We can create strings using string literals, which are sequences of characters surrounded by double quotation marks; for example, take the string literal "hello world". String literals are automatica...
An array of strings can mean a couple of things: An array whose elements are char *s An array whose elements are arrays of chars We can create an array of character pointers like so: char * string_array[] = { "foo", "bar", "baz" }; Remember: w...
A minimal CMake project file that uses Qt5 can be: cmake_minimum_required(VERSION 2.8.11) project(myproject) find_package(Qt5 5.7.0 REQUIRED COMPONENTS Core ) set(CMAKE_AUTOMOC ON) add_executable(${PROJECT_NAME} main.cpp ) target_link_libraries(${PROJECT_NAME} Qt5::C...
If you use an index that is sorted the way you would retrieve it, the SELECT statement would not do additional sorting when in retrieval. CREATE INDEX ix_scoreboard_score ON scoreboard (score DESC); When you execute the query SELECT * FROM scoreboard ORDER BY score DESC; The database system ...
In the Project.pro file we add : CONFIG += sql in MainWindow.h we write : #include <QMainWindow> #include <QSql> #include <QDebug> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWid...
In the Project.pro file we add : CONFIG += sql in MainWindow.h we write : #include <QMainWindow> #include <QSql> #include <QDebug> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget...
In the Project.pro file we add : CONFIG += sql in MainWindow.h we write : #include <QMainWindow> #include <QSql> #include <QDebug> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget...
Layout Unity basic editor will look like below. Basic functionalities of some default windows/tabs are described in the image. Linux Layout There is a little difference in menu layout of linux version, like the screenshot below, Basic Usage Create an empty GameObject by right clicking in th...
Using the default constructor T variable = Activator.CreateInstance(typeof(T)); Using parameterized constructor T variable = Activator.CreateInstance(typeof(T), arg1, arg2);
Occasionally you'd want to catch an exception and throw it from a different thread or method while preserving the original exception stack. This can be done with ExceptionDispatchInfo: using System.Runtime.ExceptionServices; void Main() { ExceptionDispatchInfo capturedException = null; ...

Page 245 of 1336