range

The range function represents an immutable sequence of integers. If used by passing it a single stop argument, it generates a sequence of consecutive integers between 0 and stop -1. If used by passing it two arguments, start and stop, it generates a sequence of consecutive integers between start and stop -1. In the latter case, the inclusion of a third step argument forces the sequence of numbers to be generated with a "step" jump between one number and the next.

Submitted by admin on Sun, 01/17/2021 - 12:25

pandas.DataFrame.rank

The rank method of a pandas DataFrame returns another pandas DataFrame in which the values are the result of assigning ranges (from 1 to n) to the values of the original DataFrame, considering them ordered, by default, from lowest to highest along axis 0. That is, the smallest value in a column receives rank 1, the next rank 2, and so on. The method parameter controls the method of assigning ranges to matching values.

The index of the original DataFrame is preserved. The assigned ranges are real numbers.

Submitted by admin on Fri, 01/15/2021 - 16:44

next

The next function returns the next element of the iterator included as the first argument by invoking its __next__ method.

In the case that the iterator is empty, an exception of type StopIteration will be generated unless a second argument ("default") has been included, in which case it will be returned as a result of the function.

Submitted by admin on Thu, 01/14/2021 - 18:14

iter

The iter function returns an iterable object from another object. In its simplest configuration it will only receive one argument -the object to be made iterable-. This requires that said object support the iteration or sequence protocols (__iter__ and __getitem__ methods respectively). If none of them are supported, the iter function will return a type error (TypeError).

Submitted by admin on Thu, 01/14/2021 - 17:41

map

The map function applies a function to the values of the iterable that we specify as an argument. In the case that two or more iterables are specified as arguments, the function will consider their values in parallel, stopping returning values as soon as the end of the shortest iterable is reached (see examples below).

Submitted by admin on Thu, 01/14/2021 - 17:07

issubclass

The issubclass function takes two classes, class and classinfo, as arguments, and returns the boolean True if class is a subclass of classinfo, or False otherwise.

A class is always considered a subclass of itself.

Submitted by admin on Wed, 01/13/2021 - 17:40

isinstance

The isinstance function takes an object and a class as arguments and returns True if the object is an instance of that class or an instance of a subclass of it.

The second argument (the class) can also be a tuple of classes or a recursive structure of tuples of classes, in which case the boolean True will be returned if the object belongs to any of the classes contained in the structure.

Submitted by admin on Wed, 01/13/2021 - 15:24

id

The id function returns the "identity" of an object, that is, a constant numeric value that uniquely identifies the object for as long as it is defined.

In Python, anything is an object, so we can get the identity from -even- the id function.

The identity of an object can vary from one execution of the code to another. Some objects always receive the same identity (integers between -5 and 256 inclusive, for example).

Submitted by admin on Wed, 01/13/2021 - 14:56