Tutorial by Examples: and

To get basic information about a DataFrame including the column names and datatypes: import pandas as pd df = pd.DataFrame({'integers': [1, 2, 3], 'floats': [1.5, 2.5, 3], 'text': ['a', 'b', 'c'], 'ints with None': [1, None, 3]}) ...
End a line with two or more spaces to create a line break. Ending a line with no spaces or with just one space doesn't create a line beak. Use two or more spaces to create a line break. Use an empty line to make a new paragraph. Ending a line with no spaces or with just one space...
First of all, we need to add our first Fragment at the beginning, we should do it in the onCreate() method of our Activity: if (null == savedInstanceState) { getSupportFragmentManager().beginTransaction() .addToBackStack("fragmentA") .replace(R.id.container, FragmentA.n...
ansible -i hosts -m ping targethost -i hosts defines the path to inventory file targethost is the name of the host in the hosts file
Returns a random integer between min and max: function randomBetween(min, max) { return Math.floor(Math.random() * (max - min + 1) + min); } Examples: // randomBetween(0, 10); Math.floor(Math.random() * 11); // randomBetween(1, 10); Math.floor(Math.random() * 10) + 1; // randomBet...
public void iterateAndFilter() throws IOException { Path dir = Paths.get("C:/foo/bar"); PathMatcher imageFileMatcher = FileSystems.getDefault().getPathMatcher( "regex:.*(?i:jpg|jpeg|png|gif|bmp|jpe|jfif)"); try (Direc...
# For Python 2 compatibility. from __future__ import print_function import lxml.html import requests def main(): r = requests.get("https://httpbin.org") html_source = r.text root_element = lxml.html.fromstring(html_source) # Note root_element.xpath() gives a *...
It's important to let finalization ignore managed resources. The finalizer runs on another thread -- it's possible that the managed objects don't exist anymore by the time the finalizer runs. Implementing a protected Dispose(bool) method is a common practice to ensure managed resources do not have t...
When a controller action is rendered, Rails will attempt to find a matching layout and view based on the name of the controller. Views and layouts are placed in the app/views directory. Given a request to the PeopleController#index action, Rails will search for: the layout called people in app/...
The StringBuffer, StringBuilder, Formatter and StringJoiner classes are Java SE utility classes that are primarily used for assembling strings from other information: The StringBuffer class has been present since Java 1.0, and provides a variety of methods for building and modifying a "buf...
Rails files - and Ruby files in general - should be named with lower_snake_case filenames. E.g. app/controllers/application_controller.rb is the file that contains the ApplicationController class definition. Note that while PascalCase is used for class and module names, the files in which they r...
Generally, sets are a type of collection which stores unique values. Uniqueness is determined by the equals() and hashCode() methods. Sorting is determined by the type of set. HashSet - Random Sorting Java SE 7 Set<String> set = new HashSet<> (); set.add("Banana"); set.ad...
If you want to handle such scenario just add an if/else statement. if ( have_posts() ) : while ( have_posts() ) : the_post(); var_dump( $post ); endwhile; else : __('This Query does not have any results'); endif;
The default property getters and setters can be overridden: @interface TestClass @property NSString *someString; @end @implementation TestClass // override the setter to print a message - (void)setSomeString:(NSString *)newString { NSLog(@"Setting someString to %@", newS...
Assuming a source file of hello_world.v and a top level module of hello_world. The code can be run using various simulators. Most simulators are compiled simulators. They require multiple steps to compile and execute. Generally the First step is to compile the Verilog design. Second step is to ...
The syntax for Java generics bounded wildcards, representing the unknown type by ? is: ? extends T represents an upper bounded wildcard. The unknown type represents a type that must be a subtype of T, or type T itself. ? super T represents a lower bounded wildcard. The unknown type repres...
For programmers coming from GCC or Clang to Visual Studio, or programmers more comfortable with the command line in general, you can use the Visual C++ compiler from the command line as well as the IDE. If you desire to compile your code from the command line in Visual Studio, you first need to set...
DataFrame: import pandas as pd import numpy as np np.random.seed(5) df = pd.DataFrame(np.random.randint(100, size=(5, 5)), columns = list("ABCDE"), index = ["R" + str(i) for i in range(5)]) df Out[12]: A B C D E R0 99 78 61 16 73...
Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) .responseJSON { response in print(response.request) // original URL request print(response.response) // URL response print(response.data) // server da...
Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) .validate() .response { request, response, data, error in print(request) print(response) print(data) print(error) }

Page 25 of 153