Range: How to Calculate and Interpret this Statistical Measure
- gingferbadeticno
- Aug 13, 2023
- 6 min read
Return an iterator that applies function to every item of iterable,yielding the results. If additional iterables arguments are passed,function must take that many arguments and is applied to the items from alliterables in parallel. With multiple iterables, the iterator stops when theshortest iterable is exhausted. For cases where the function inputs arealready arranged into argument tuples, see itertools.starmap().
range
Return a slice object representing the set of indices specified byrange(start, stop, step). The start and step arguments default toNone. Slice objects have read-only data attributes start,stop, and step which merely return the argumentvalues (or their default). They have no other explicit functionality;however, they are used by NumPy and other third-party packages.Slice objects are also generated when extended indexing syntax is used. Forexample: a[start:stop:step] or a[start:stop, i]. Seeitertools.islice() for an alternate version that returns an iterator.
A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. During the aggregation process, the values extracted from each document will be checked against each bucket range and "bucket" the relevant/matching document.Note that this aggregation includes the from value and excludes the to value for each range.
This is done without interpolating between the histogram field values. Consequently, it is possible to have a rangethat is "in-between" two histogram values. The resulting range bucket would have a zero doc count.
Range aggregation is a bucket aggregation, which partitions documents into buckets rather than calculating metrics over fields likemetrics aggregations do. Each bucket represents a collection of documents which sub-aggregations can run on.On the other hand, a histogram field is a pre-aggregated field representing multiple values inside a single field:buckets of numerical data and a count of items/documents for each bucket. This mismatch between the range aggregations expected input(expecting raw documents) and the histogram field (that provides summary information) limits the outcome of the aggregationto only the doc counts for each bucket.
The range generally gives you a good indicator of variability when you have a distribution without extreme values. When paired with measures of central tendency, the range can tell you about the span of the distribution.
Use Range (arg), where arg names the range, to return a Range object that represents a single cell or a range of cells. The following example places the value of cell A1 in cell A5.
The following example fills the range A1:H8 with random numbers by setting the formula for each cell in the range. When it's used without an object qualifier (an object to the left of the period), the Range property returns a range on the active sheet. If the active sheet isn't a worksheet, the method fails.
Use Cells on a worksheet to obtain a range consisting all single cells on the worksheet. You can access single cells via Item(row, column), where row is the row index and column is the column index.Item can be omitted since the call is forwarded to it by the default member of Range.The following example sets the value of cell A1 to 24 and of cell B1 to 42 on the first sheet of the active workbook.
Use_expression_.Cells, where expression is an expression that returns a Range object, to obtain a range with the same address consisting of single cells.On such a range, you access single cells via Item(row, column), where are relative to the upper-left corner of the first area of the range.Item can be omitted since the call is forwarded to it by the default member of Range.The following example sets the formula for cell C5 and D5 of the first sheet of the active workbook.
Use Rows on a worksheet to obtain a range consisting all rows on the worksheet. You can access single rows via Item(row), where row is the row index.Item can be omitted since the call is forwarded to it by the default member of Range.
Use Columns on a worksheet to obtain a range consisting all columns on the worksheet. You can access single columns via Item(row) [sic], where row is the column index given as a number or as an A1-style column address.Item can be omitted since the call is forwarded to it by the default member of Range.
Use_expression_.Rows, where expression is an expression that returns a Range object, to obtain a range consisting of the rows in the first area of the range.You can access single rows via Item(row), where row is the relative row index from the top of the first area of the range.Item can be omitted since the call is forwarded to it by the default member of Range.
Use_expression_.Columns, where expression is an expression that returns a Range object, to obtain a range consisting of the columns in the first area of the range.You can access single columns via Item(row) [sic], where row is the relative column index from the left of the first area of the range given as a number or as an A1-style column address.Item can be omitted since the call is forwarded to it by the default member of Range.
Use Offset (row, column), where row and column are the row and column offsets, to return a range at a specified offset to another range. The following example selects the cell three rows down from and one column to the right of the cell in the upper-left corner of the current selection. You cannot select a cell that is not on the active sheet, so you must first activate the worksheet.
This example uses the AdvancedFilter method of the Range object to create a list of the unique values, and the number of times those unique values occur, in the range of column A.
Range types are useful because they represent many element values in a single range value, and because concepts such as overlapping ranges can be expressed clearly. The use of time and date ranges for scheduling purposes is the clearest example; but price ranges, measurement ranges from an instrument, and so forth can also be useful.
Every range type has a corresponding multirange type. A multirange is an ordered list of non-contiguous, non-empty, non-null ranges. Most range operators also work on multiranges, and they have a few functions of their own.
Every non-empty range has two bounds, the lower bound and the upper bound. All points between these values are included in the range. An inclusive bound means that the boundary point itself is included in the range as well, while an exclusive bound means that the boundary point is not included in the range.
The lower bound of a range can be omitted, meaning that all values less than the upper bound are included in the range, e.g., (,3]. Likewise, if the upper bound of the range is omitted, then all values greater than the lower bound are included in the range. If both lower and upper bounds are omitted, all values of the element type are considered to be in the range. Specifying a missing bound as inclusive is automatically converted to exclusive, e.g., [,] is converted to (,). You can think of these missing values as +/-infinity, but they are special range type values and are considered to be beyond any range element type's +/-infinity values.
The parentheses or brackets indicate whether the lower and upper bounds are exclusive or inclusive, as described previously. Notice that the final pattern is empty, which represents an empty range (a range that contains no points).
Each bound value can be quoted using " (double quote) characters. This is necessary if the bound value contains parentheses, brackets, commas, double quotes, or backslashes, since these characters would otherwise be taken as part of the range syntax. To put a double quote or backslash in a quoted bound value, precede it with a backslash. (Also, a pair of double quotes within a double-quoted bound value is taken to represent a double quote character, analogously to the rules for single quotes in SQL literal strings.) Alternatively, you can avoid quoting and use backslash-escaping to protect all data characters that would otherwise be taken as range syntax. Also, to write a bound value that is an empty string, write "", since writing nothing means an infinite bound.
Whitespace is allowed before and after the range value, but any whitespace between the parentheses or brackets is taken as part of the lower or upper bound value. (Depending on the element type, it might or might not be significant.)
The input for a multirange is curly brackets ( and ) containing zero or more valid ranges, separated by commas. Whitespace is permitted around the brackets and commas. This is intended to be reminiscent of array syntax, although multiranges are much simpler: they have just one dimension and there is no need to quote their contents. (The bounds of their ranges may be quoted as above however.)
Each range type also has a multirange constructor with the same name as the multirange type. The constructor function takes zero or more arguments which are all ranges of the appropriate type. For example:
A discrete range type should have a canonicalization function that is aware of the desired step size for the element type. The canonicalization function is charged with converting equivalent values of the range type to have identical representations, in particular consistently inclusive or exclusive bounds. If a canonicalization function is not specified, then ranges with different formatting will always be treated as unequal, even though they might represent the same set of values in reality. 2ff7e9595c
Comments