Tutorial by Examples: sin

If you have a dataframe with missing data (NaN, pd.NaT, None) you can filter out incomplete rows df = pd.DataFrame([[0,1,2,3], [None,5,None,pd.NaT], [8,None,10,None], [11,12,13,pd.NaT]],columns=list('ABCD')) df # Output: # A B ...
The code below calculates the value of PI using a recursive approach. Modify the MAX_PARALLEL_RECURSIVE_LEVEL value to determine at which recursion depth stop creating tasks. With this approach to create parallelism out of recursive applications: the more tasks you create, the more parallel tasks cr...
Probably the easiest choice, but beware, the version is not always the newest one. Just open up terminal and type (depending on your distribution) in Debian or Ubuntu using apt $> sudo apt install ruby in CentOS, openSUSE or Fedora $> sudo yum install ruby You can use the -y option so...
Probably the easies way to set up ruby on windows is to go to http://rubyinstaller.org/ and from there donwload an executable that you will install. You don't have to set almost anything, but there will be one important window. It will have a check box saying Add ruby executable to your PATH. Confi...
Consider the ranges A1:A3 and B1:B3 having the same size and only number values, as below =SUMPRODUCT(A1:A3,B1:B3) This will loop through the ranges, taking the product of values in the same row and summing them, returning 32 in this example. A1*B1 = 4 A2*B2 = 10 A3*B3 = 18
Consider the following ranges A1:A3 and B1:B3 as below =SUMPRODUCT(--(A1:A3="c"),B1:B3) This will first manipulate (A1:A3="c") into the following array A1="c" = FALSE A2="c" = FALSE A3="c" = TRUE Then apply the -- operator which converts...
In [1]: import pandas as pd import numpy as np arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] idx_row = pd.MultiIndex.from_arrays(arrays, names=['Row_First', 'Row_Second']) idx_col = pd.MultiIndex.from_pro...
Unlike the .xs method, this allows you to assign values. Indexing using slicers is available since version 0.14.0. In [1]: import pandas as pd import numpy as np arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two'...
UIKit is the iOS framework that implements the standard UI components for iOS applications. Building an app with UIKit is trivially easy. In all cases you'll use Xcode, Apple's IDE for developing for iOS and macOS. In Swift, you just put the statement import UIKit At the top of a each source f...
Once a model is built predict is the main function to test with new data. Our example will use the mtcars built-in dataset to regress miles per gallon against displacement: my_mdl <- lm(mpg ~ disp, data=mtcars) my_mdl Call: lm(formula = mpg ~ disp, data = mtcars) Coefficients: (Intercep...
To use Splatting to call Get-Process with the -FileVersionInfo switch similar to this: Get-Process -FileVersionInfo This is the call using splatting: $MyParameters = @{ FileVersionInfo = $true } Get-Process @MyParameters Note: This is useful because you can create a default set of p...
ActionMailer ActionPack ActionWebService ActiveRecord ActiveSupport Railties
ActionMailer ActionPack ActiveRecord ActiveResource (ActiveWebService was replaced by ActiveResource, and with that, Rails moved from SOAP to REST by default) ActiveSupport Railties
ActionMailer ActionPack ActiveModel ActiveRecord ActiveResource ActiveSupport Railties
As you can see the layout of this gem is very catching and user friendly.
This example is filtered text from an IRB session. => require 'erb' => input = <<-HEREDOC <ul> <% (0..10).each do |i| %> <%# This is a comment %> <li><%= i %> is <%= i.even? ? 'even' : 'odd' %>.</li> <% end %> </ul> H...
In order to achieve type safety sometimes we want to avoid the use of primitive types on our domain. For instance, imagine a Person with a name. Typically, we would encode the name as a String. However, it would not be hard to mix a String representing a Person's name with a String representing an e...
In OCaml, there are different arithmetic operators for floats and integers. Additionally, these operators can only be used on 2 floats or 2 integers. Here are invalid expressions in OCaml 1.0 + 2.0 1 + 2.0 1 +. 2 1 +. 2.0 The correct expression for each of these respectively are 1. +. 2. fl...
This is just an extension on the sealed trait variant where a macro generates a set with all instances at compile time. This nicely omits the drawback that a developer can add a value to the enumeration but forget to add it to the allElements set. This variant especially becomes handy for large en...
First lets create a vector called Vector1: set.seed(123) Vector1 <- rnorm(20) And add missing data to it: set.seed(123) Vector1[sample(1:length(Vector1), 5)] <- NA Now we can use the is.na function to subset the Vector Vector1 <- Vector1[!is.na(Vector1)] Now the resulting vect...

Page 127 of 161