This will be our example data frame:
color name size
0 red rose big
1 blue violet big
2 red tulip small
3 blue harebell small
Using the magic __getitem__ or [] accessor. Giving it a list of True and False of the same length as the dataframe will give you:
...
This will be our example data frame:
color name size
0 red rose big
1 blue violet small
2 red tulip small
3 blue harebell small
Accessing a single column from a data frame, we can use a simple comparison == to compare every element in the column to the given...
This will be our example data frame:
color size
name
rose red big
violet blue small
tulip red small
harebell blue small
We can create a mask based on the index values, just like on a column value.
rose_mask = df.index == 'rose'
df[rose_mask...
Let's consider this example, that outputs the squares of the numbers 3, 5, and 7:
let nums = [3, 5, 7]
let squares = nums.map(function (n) {
return n * n
})
console.log(squares)
Run in RunKit
The function passed to .map can also be written as arrow function by removing the function keywor...
This example will demonstrate how to get started with Firebase in your web apps with JavaScript.
We are going to add a text child in our Firebase Database and display it in realtime on our web app.
Lets get started.
Go to the Firebase Console - https://console.firebase.google.com and create a...
Opening a browser with to() method.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
class navigateWithTo{
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.example.com...
Sample Data
XML Document
First, let's define a sample XML document named "books.xml" in our current directory:
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<title>Of Mice And Men</title>
<author>Joh...
This is an enumeration for const creation. Go compiler starts iota from 0 and increments by one for each following constant. The value is determined at compile time rather than run time. Because of this we can't apply iota to expressions which are evaluated at run time.
Program to use iota in cons...
This is a more flexible alternative to thread first or thread last. It can be inserted anywhere in the list of parameters of the function.
(as-> [1 2] x
(map #(+ 1 %) x)
(if (> (count x) 2) "Large" "Small"))
Lightweight simple translation module with dynamic json storage. Supports plain vanilla node.js apps and should work with any framework (like express, restify and probably more) that exposes an app.use() method passing in res and req objects. Uses common __('...') syntax in app and templates. Stores...
To use Autofac in your project, all you have to do is install Autofac from NuGet Package Manager. Open the solution that want to use Autofac in, then select Manager NuGet Packages for Solution... by going to:
Tools -> NuGet Package Manager -> Manager NuGet Packages for Solution...
In the N...
Validating the Name entered by a User contain the following check
Ensure it is not empty
Ensure it contain only alphabets, space and/or dot.
So, the regular expression for this is
^[A-Z][a-z]*(\.?\s?[A-Z][a-z]*)+$
This means
^ -> Should start with
[A-Z] -> the first lette...
Let's take the Range is from 18 to 80.
So, to validate,
We should check that the age is a positive integer.
Then check it should be greater than or equal to 18 and less than or equal to 80.
The test to check whether it is a number or not can be performed by a simple regular expression like
^[0-...
Sometimes, we have to take input from users which should contain only alpha numeric characters.
For example, lets say a Username system which allow only letters and numbers,
Then this can be done with the following Regular Expression
^[a-zA-Z0-9]+$
^ is restrict the start
[a-zA-Z0-9]+ is th...
To call the QML classes in C++, you need to set the objectName property.
In your Qml:
import QtQuick.Controls 2.0
Button {
objectName: "buttonTest"
}
Then, in your C++, you can get the object with QObject.FindChild<QObject*>(QString)
Like that:
QQmlApplicationEngine e...
Each watchOS target includes an App and an Extension. App contains the UI stuff and Extension contains the actual logic (similar to Views and Models in MVC architecture in iOS).
Each WatchKit App has a Interface.storyboard file which you design the app in it, and a Assets.xcassets file to put your ...
Many watchOS apps (like Activity) have several pages which you could simply scroll between them, which is a very good way to use Apple Watch.
To create a page based navigation, Ctrl-Drag from one controller to another, and select "next page", as shown in the following picture: