A series is a one-dimension data structure. It's a bit like a supercharged array, or a dictionary.
import pandas as pd
s = pd.Series([10, 20, 30])
>>> s
0 10
1 20
2 30
dtype: int64
Every value in a series has an index. By default, the indices are integers, running fro...
from pandas_datareader import data
# Only get the adjusted close.
aapl = data.DataReader("AAPL",
start='2015-1-1',
end='2015-12-31',
data_source='yahoo')['Adj Close']
>>> aapl.plot(title='AAPL Adj. C...
<?php
use yii\db\Migration;
class m150101_185401_create_news_table extends Migration
{
public function up()
{
}
public function down()
{
echo "m101129_185401_create_news_table cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migra...
Given any value of type Int or Long to render a human readable string:
fun Long.humanReadable(): String {
if (this <= 0) return "0"
val units = arrayOf("B", "KB", "MB", "GB", "TB", "EB")
val digitGroups = (Mat...
A common use case for extension methods is to improve an existing API. Here are examples of adding exist, notExists and deleteRecursively to the Java 7+ Path class:
fun Path.exists(): Boolean = Files.exists(this)
fun Path.notExists(): Boolean = !this.exists()
fun Path.deleteRecursively(): Bool...
With this declaration:
fun Temporal.toIsoString(): String = DateTimeFormatter.ISO_INSTANT.format(this)
You can now simply:
val dateAsString = someInstant.toIsoString()
In the simple example, we simply set the width of the rectangle to that of it's parent. Let's consider a more complicated example:
ApplicationWindow {
visible: true
width: 400
height: 640
Rectangle{
id: rect
anchors.centerIn: parent
height: 100
...
Python has only limited support for parsing ISO 8601 timestamps. For strptime you need to know exactly what format it is in. As a complication the stringification of a datetime is an ISO 8601 timestamp, with space as a separator and 6 digit fraction:
str(datetime.datetime(2016, 7, 22, 9, 25, 59, 55...
Install the necessary Python Library via:
$ pip install elasticsearch
Connect to Elasticsearch, Create a Document (e.g. data entry) and "Index" the document using Elasticsearch.
from datetime import datetime
from elasticsearch import Elasticsearch
# Connect to Elasticsearch using ...
For ease of testing, sklearn provides some built-in datasets in sklearn.datasets module. For example, let's load Fisher's iris dataset:
import sklearn.datasets
iris_dataset = sklearn.datasets.load_iris()
iris_dataset.keys()
['target_names', 'data', 'target', 'DESCR', 'feature_names']
You can ...
package {
import flash.text.TextField;
import flash.display.Sprite;
public class TextHello extends Sprite {
public function TextHello() {
var tf:TextField = new TextField();
tf.text = "Hello World!"
tf.x = 50;
tf...
sqldf() from the package sqldf allows the use of SQLite queries to select and manipulate data in R. SQL queries are entered as character strings.
To select the first 10 rows of the "diamonds" dataset from the package ggplot2, for example:
data("diamonds")
head(diamonds)
#...
Signals and slots are used for communication between objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks.
The minimal example requires a class with one signal, one slot and one connection:
counte...
PropertyPossible Valuesdisplaygrid / inline-grid
The CSS Grid is defined as a display property. It applies to a parent element and its immediate children only.
Consider the following markup:
<section class="container">
<div class="item1">item1</div>
<...