API Reference¶
Top-level expression APIs¶
These methods are available directly in the ibis
module namespace.
|
Similar to the .case method on array expressions, create a case builder that accepts self-contained boolean expressions (as opposed to expressions which are to be equality-compared with a fixed value expression) |
|
Create a scalar expression from a Python value. |
|
Validate and return an Ibis Schema object |
|
Create an unbound Ibis table for creating expressions. |
|
Returns a timestamp literal if value is likely coercible to a timestamp |
|
Equivalent to the ternary expression: if X then Y else Z |
|
Shorthand for implementing ternary expressions |
|
Compute the first non-null value(s) from the passed arguments in left-to-right order. |
|
Compute the largest value (row-wise, if any arrays are present) among the supplied arguments. |
|
Compute the smallest value (row-wise, if any arrays are present) among the supplied arguments. |
|
Negate a numeric expression |
|
Create a sort key (when used in sort_by) by the passed array expression or column name. |
|
Compute the current timestamp |
|
Create a NULL/NA scalar |
|
|
Analytic function for the current row number, starting at 0. |
|
|
Create a window clause for use with window functions. |
|
Create a range-based window clause for use with window functions. |
|
Create a trailing window for use with aggregate window functions. |
|
Create a cumulative window for use with aggregate window functions. |
|
Create a trailing time window for use with aggregate window functions. |
|
Return a random floating point number in the range [0.0, 1.0). |
General expression methods¶
|
Compile expression to whatever execution target, to verify |
|
|
|
If this expression is based on physical tables in a database backend, execute it against that backend. |
|
Generic composition function to enable expression pipelining. |
Returns True if expression can be compiled to its attached client |
Table methods¶
|
Aggregate a table with a given set of reductions, with grouping expressions, and post-aggregation filters. |
|
Perform an asof join between two tables. |
Returns the computed number of rows in the table expression |
|
Compute set of unique rows/tuples occurring in this table |
|
|
|
|
Similar to pandas DataFrame.info. |
|
Select rows from table based on boolean expressions |
|
Get a reference to a single column from the table |
|
Get multiple columns from the table |
|
Create an intermediate grouped table expression, pending some group operation to be applied with it. |
|
Create an intermediate grouped table expression, pending some group operation to be applied with it. |
|
Select the first n rows at beginning of table (may not be deterministic depending on implementation and presence of a sorting). |
|
Convenience function for table projections involving adding columns |
|
Compute new table expression with the indicated column expressions from this table. |
|
Change table column names, otherwise leaving table unaltered |
An autonumeric representing the row number of the results. |
|
Get the schema for this table (if one is known) |
|
|
Replace an existing column with a new expression |
|
Sort table by the indicated column expressions and sort orders (ascending/descending) |
|
Form the table set union of two table expressions having identical schemas. |
Create a new table expression that is semantically equivalent to the current one, but is considered a distinct relation for evaluation purposes (e.g. |
|
|
Perform a relational join between two tables. |
|
Perform a cross join (cartesian product) amongst a list of tables, with optional set of prefixes to apply to overlapping column names |
|
Perform a relational join between two tables. |
|
Perform a relational join between two tables. |
|
Perform a relational join between two tables. |
|
Perform a relational join between two tables. |
|
Perform a relational join between two tables. |
Grouped table methods¶
|
|
|
Convenience function for computing the group sizes (number of rows per group) given a grouped table. |
|
Add a post-aggregation result filter (like the having argument in aggregate), for composability with the group_by API |
|
Returns a table projection with analytic / window functions applied. |
Expressions to use for ordering data for a window function computation. |
|
|
Add a window clause to be applied to downstream analytic expressions |
|
Like mutate, but do not include existing table columns |
|
Convenience function for computing the group sizes (number of rows per group) given a grouped table. |
Generic value methods¶
Scalar or column methods¶
|
Check if the input expr falls between the lower/upper bounds passed. |
|
Cast value(s) to indicated data type. |
Compute the first non-null value(s) from the passed arguments in left-to-right order. |
|
|
Replace any null values with the indicated fill value |
|
Check whether the value expression is contained within the indicated list of values. |
|
Like isin, but checks whether this expression’s value(s) are not contained in the passed values. |
|
Set values to null if they match/equal a particular expression (scalar or array-valued). |
|
Compute an integer hash value for the indicated value expression. |
Returns true if values are null |
|
Returns true if values are not null |
|
|
Turn an aggregation or full-sample analytic operation into a windowed operation. |
Return the data type of the argument according to the current backend |
|
Create a new SimpleCaseBuilder to chain multiple if-else statements. |
|
|
Create a case expression in one shot. |
|
Substitute (replace) one or more values in a value expression |
Column methods¶
Compute set of unique values occurring in this array. |
|
|
Compute cardinality / sequence size of expression. |
|
|
|
|
|
|
|
|
|
Concatenate values using the indicated separator (comma by default) to produce a string |
|
|
|
Compute a set of summary metrics from the input value expression |
|
Compute a frequency table for this value expression |
Compute position of first element within each equal-value group in sorted order, ignoring duplicate values. |
|
Compute position of first element within each equal-value group in sorted order. |
|
|
|
|
|
Cumulative min. |
|
Cumulative max. |
General numeric methods¶
Scalar or column methods¶
Absolute value |
|
Round up to the nearest integer value greater than or equal to this value |
|
Round down to the nearest integer value less than or equal to this value |
|
|
Perform the logarithm using a specified base |
Natural logarithm |
|
Logarithm base 2 |
|
Logarithm base 10 |
|
|
Round values either to integer or indicated number of decimal places. |
Set values to NULL if they equal to zero. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Column methods¶
|
|
|
|
|
Compute standard deviation of numeric array |
|
Compute standard deviation of numeric array |
Cumulative sum. |
|
Cumulative mean. |
|
|
|
|
|
|
Compute a discrete binning of a numeric array |
|
Compute a histogram with fixed width bins |
Integer methods¶
Scalar or column methods¶
|
Convert number (as integer or string) from one base to another |
|
Convert integer UNIX timestamp (at some resolution) to a timestamp type |
String methods¶
All string operations are valid either on scalar or array values
|
Convert number (as integer or string) from one base to another |
Compute length of strings |
|
Convert string to all lowercase |
|
Convert string to all uppercase |
|
Reverse string |
|
Remove whitespace from left and right sides of string |
|
Remove whitespace from left side of string |
|
Remove whitespace from right side of string |
|
Return a capitalized version of input string |
|
|
Determine if indicated string is exactly contained in the calling string. |
|
Wildcard fuzzy matching function equivalent to the SQL LIKE directive. |
|
Parses a string and returns a timestamp. |
|
Returns the portion of a URL corresponding to a part specified by ‘extract’ Can optionally specify a key to retrieve an associated value if extract parameter is ‘QUERY’ |
|
Pull substrings out of each string value by position and maximum length. |
|
Return left-most up to N characters from each string. |
|
Return up to nchars starting from end of each string. |
Returns the argument string repeated n times |
|
|
Returns position (0 indexed) of first occurence of substring, optionally after a particular position (0 indexed) |
|
Returns string with set of ‘from’ characters replaced by set of ‘to’ characters. |
|
Returns postion (0 indexed) of first occurence of argument within a list of strings. |
|
Joins a list of strings together using the calling string as a separator |
|
Replaces each exactly occurrence of pattern with given replacement string. |
|
Returns string of given length by truncating (on right) or padding (on left) original string |
|
Returns string of given length by truncating (on right) or padding (on right) original string |
|
Search string values using a regular expression. |
|
Search string values using a regular expression. |
|
Returns specified index, 0 indexed, from string based on regex pattern given |
|
Replaces match found by regex with replacement string. |
Timestamp methods¶
All timestamp operations are valid either on scalar or array values
|
Format timestamp according to the passed format string. |
Namespace expression containing methods for extracting information about the day of the week of a TimestampValue or DateValue expression. |
|
|
Zero out smaller-size units beyond indicated unit. |
Return a Time node for a Timestamp. |
|
Return a Date for a Timestamp. |
|
|
|
|
|
|
|
|
Date methods¶
|
Format timestamp according to the passed format string. |
Namespace expression containing methods for extracting information about the day of the week of a TimestampValue or DateValue expression. |
|
|
Zero out smaller-size units beyond indicated unit. |
|
|
|
|
|
|
|
Day of week methods¶
Get the index of the day of the week. |
|
Get the name of the day of the week. |
Time methods¶
|
Check if the input expr falls between the lower/upper bounds passed. |
|
Zero out smaller-size units beyond indicated unit. |
|
|
|
|
|
|
|
Interval methods¶
|
|
Extract the number of years from an IntervalValue expression. |
|
Extract the number of quarters from an IntervalValue expression. |
|
Extract the number of months from an IntervalValue expression. |
|
Extract the number of weeks from an IntervalValue expression. |
|
Extract the number of days from an IntervalValue expression. |
|
Extract the number of hours from an IntervalValue expression. |
|
Extract the number of minutes from an IntervalValue expression. |
|
Extract the number of seconds from an IntervalValue expression. |
|
Extract the number of milliseconds from an IntervalValue expression. |
|
Extract the number of microseconds from an IntervalValue expression. |
|
Extract the number of nanoseconds from an IntervalValue expression. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Negate a numeric expression |
Boolean methods¶
|
Shorthand for implementing ternary expressions |
Category methods¶
Category is a logical type with either a known or unknown cardinality. Values are represented semantically as integers starting at 0.
|
Format a known number of categories as strings |
Decimal methods¶
Struct methods¶
Scalar or column methods¶
Values in a StructValue
can be accessed using indexing, e.g. struct_expr['my_col']
. See StructValue.__getitem__()
.
Destructure a |
|
|
Get the field_name field from the |
Geospatial methods¶
Scalar or column methods¶
Compute area of a geo spatial data |
|
Get the geometry as well-known bytes (WKB) without the SRID data. |
|
Get the geometry as well-known bytes (WKB) with the SRID data. |
|
Get the geometry as well-known text (WKT) with the SRID data. |
|
Get the geometry as well-known text (WKT) without the SRID data. |
|
|
Check if the geometries have at least one point in common, but do not intersect. |
|
Returns a geometry that represents all points whose distance from this Geometry is less than or equal to distance. |
Returns the centroid of the geometry. |
|
|
Check if the first geometry contains the second one |
Check if the first geometry contains the second one, with no common border points. |
|
|
Check if the first geometry covers the second one. |
|
Check if the first geometry is covered by the second one. |
|
Check if the geometries have some, but not all, interior points in common. |
|
Check if the first geometry is fully within a specified distance from the second one. |
|
Check if the first geometry is within a specified distance from the second one. |
|
Return the difference of two geometries. |
|
Check if the geometries have no points in common. |
|
Compute distance between two geo spatial data |
Returns the last point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING |
|
Returns a geometry representing the bounding box of the arg. |
|
|
Check if the geometries are the same. |
Get the 1-based Nth geometry of a multi geometry. |
|
Get the type of a geometry. |
|
|
Return the intersection of two geometries. |
|
Check if the geometries share any points. |
Check if the geometry is valid. |
|
Locate the distance a point falls along the length of a line. |
|
Merge a MultiLineString into a LineString. |
|
|
Clip a substring from a LineString. |
Compute length of a geo spatial data |
|
|
Returns the 2-dimensional maximum distance between two geometries in projected units. |
Return the number of points in a geometry. |
|
If the geometry is a polygon or multi-polygon returns the number of rings. |
|
Check if two geometries are equal and have the same point ordering. |
|
|
Check if the geometries share space, are of the same dimension, but are not completely contained by each other. |
Compute perimeter of a geo spatial data |
|
Return the Nth point in a single linestring in the geometry. |
|
|
Set the spatial reference identifier for the ST_Geometry |
|
Simplify a given geometry. |
Returns the spatial reference identifier for the ST_Geometry |
|
Returns the first point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING |
|
|
Check if the geometries have at least one point in common, but do not intersect. |
Transform a geometry into a new SRID. |
|
|
Merge two geometries into a union geometry. |
|
Check if the first geometry is completely inside of the second. |
Return the X coordinate of the point, or NULL if not available. |
|
Returns X maxima of a geometry |
|
Returns Y minima of a geometry |
|
Return the Y coordinate of the point, or NULL if not available. |
|
Returns Y maxima of a geometry |
|
Returns Y minima of a geometry |
Column methods¶
Aggregate a set of geometries into a union. |