Returns Y minima of a bounding box 2d or 3d or a geometry.
GeoArea
GeoArea(self, **kwargs)
Area of the geo spatial data.
GeoAsBinary
GeoAsBinary(self, **kwargs)
Return the Well-Known Binary (WKB) representation of the input, without SRID meta data.
GeoAsEWKB
GeoAsEWKB(self, **kwargs)
Return the Well-Known Binary representation of the input, with SRID meta data.
GeoAsEWKT
GeoAsEWKT(self, **kwargs)
Return the Well-Known Text representation of the input, with SRID meta data.
GeoAsText
GeoAsText(self, **kwargs)
Return the Well-Known Text (WKT) representation of the input, without SRID metadata.
GeoAzimuth
GeoAzimuth(self, **kwargs)
Return the angle in radians from the horizontal of the vector defined by the two inputs.
Angle is computed clockwise from down-to-up: on the clock: 12=0; 3=PI/2; 6=PI; 9=3PI/2.
GeoBuffer
GeoBuffer(self, **kwargs)
Return all points whose distance from this geometry is less than or equal to radius.
Calculations are in the Spatial Reference System of this geometry.
GeoCentroid
GeoCentroid(self, **kwargs)
Returns the geometric center of a geometry.
GeoContains
GeoContains(self, **kwargs)
Check if the first geo spatial data contains the second one.
GeoContainsProperly
GeoContainsProperly(self, **kwargs)
Check if the left value contains the right one, with no shared no boundary points.
GeoConvert
GeoConvert(self, **kwargs)
Returns a transformed version of the given geometry from source crs/srid to a target crs/srid.
GeoCoveredBy
GeoCoveredBy(self, **kwargs)
Check if no point in the left operand is outside that of the right.
GeoCovers
GeoCovers(self, **kwargs)
Check if no point in the right operand is outside that of the left.
GeoCrosses
GeoCrosses(self, **kwargs)
Check if the inputs have some but not all interior points in common.
GeoDFullyWithin
GeoDFullyWithin(self, **kwargs)
Check if the geometries are fully within distance of one another.
GeoDWithin
GeoDWithin(self, **kwargs)
Check if the geometries are within distance of one another.
GeoDifference
GeoDifference(self, **kwargs)
Return a geometry that is the delta between the left and right inputs.
GeoDisjoint
GeoDisjoint(self, **kwargs)
Check if the Geometries do not spatially intersect.
GeoDistance
GeoDistance(self, **kwargs)
Returns minimum distance between two geospatial operands.
GeoEndPoint
GeoEndPoint(self, **kwargs)
Return the last point of a LINESTRING geometry as a POINT.
Returns NULL if the input is not a LINESTRING.
GeoEnvelope
GeoEnvelope(self, **kwargs)
The bounding box of the supplied geometry.
GeoEquals
GeoEquals(self, **kwargs)
Returns True if the given geometries represent the same geometry.
GeoFlipCoordinates
GeoFlipCoordinates(self, **kwargs)
Returns a new geometry with the coordinates of the input geometry “flipped” so that x = y and y = x.
GeoGeometryN
GeoGeometryN(self, **kwargs)
Returns the Nth Geometry of a Multi geometry.
GeoGeometryType
GeoGeometryType(self, **kwargs)
Returns the type of the geometry.
GeoIntersection
GeoIntersection(self, **kwargs)
Return a geometry that represents the point-set intersection of the inputs.
GeoIntersects
GeoIntersects(self, **kwargs)
Returns True if the Geometries/Geography “spatially intersect in 2D”.
(share any portion of space) and False if they don`t (they are Disjoint).
GeoIsValid
GeoIsValid(self, **kwargs)
Returns true if the geometry is well-formed.
GeoLength
GeoLength(self, **kwargs)
Length of geo spatial data.
GeoLineLocatePoint
GeoLineLocatePoint(self, **kwargs)
Locate the distance a point falls along the length of a line.
Returns a float between zero and one representing the location of the closest point on the linestring to the given point, as a fraction of the total 2d line length.
GeoLineMerge
GeoLineMerge(self, **kwargs)
Merge a MultiLineString into a LineString.
Returns a (set of) LineString(s) formed by sewing together the constituent line work of a multilinestring. If a geometry other than a linestring or multilinestring is given, this will return an empty geometry collection.
GeoLineSubstring
GeoLineSubstring(self, **kwargs)
Clip a substring from a LineString.
Returns a linestring that is a substring of the input one, starting and ending at the given fractions of the total 2d length. The second and third arguments are floating point values between zero and one. This only works with linestrings.
GeoMaxDistance
GeoMaxDistance(self, **kwargs)
Returns the 2-dimensional max distance between two geometries in projected units.
If g1 and g2 is the same geometry the function will return the distance between the two vertices most far from each other in that geometry
GeoNPoints
GeoNPoints(self, **kwargs)
Return the number of points in a geometry.
GeoNRings
GeoNRings(self, **kwargs)
Return the number of rings for polygons or multipolygons.
Outer rings are counted.
GeoOrderingEquals
GeoOrderingEquals(self, **kwargs)
Check if two geometries are equal and have the same point ordering.
Returns true if the two geometries are equal and the coordinates are in the same order.
GeoOverlaps
GeoOverlaps(self, **kwargs)
Check if the inputs are of the same dimension but are not completely contained by each other.
GeoPerimeter
GeoPerimeter(self, **kwargs)
Perimeter of the geo spatial data.
GeoPoint
GeoPoint(self, **kwargs)
Return a point constructed from the input coordinate values.
Constant coordinates result in construction of a POINT literal.
GeoPointN
GeoPointN(self, **kwargs)
Return the Nth point in a single linestring in the geometry.
Negative values are counted backwards from the end of the LineString, so that -1 is the last point. Returns NULL if there is no linestring in the geometry
GeoSRID
GeoSRID(self, **kwargs)
Returns the spatial reference identifier for the ST_Geometry.
GeoSetSRID
GeoSetSRID(self, **kwargs)
Set the spatial reference identifier for the ST_Geometry.
GeoSimplify
GeoSimplify(self, **kwargs)
Returns a simplified version of the given geometry.
GeoSpatialBinOp
GeoSpatialBinOp(self, **kwargs)
Geo Spatial base binary.
GeoSpatialUnOp
GeoSpatialUnOp(self, **kwargs)
Geo Spatial base unary.
GeoStartPoint
GeoStartPoint(self, **kwargs)
Return the first point of a LINESTRING geometry as a POINT.
Returns NULL if the input is not a LINESTRING.
GeoTouches
GeoTouches(self, **kwargs)
Check if the inputs have at least one point in common but their interiors do not intersect.
GeoTransform
GeoTransform(self, **kwargs)
Returns a transformed version of the given geometry into a new SRID.
GeoUnaryUnion
GeoUnaryUnion(self, **kwargs)
Returns the pointwise union of the geometries in the column.
GeoUnion
GeoUnion(self, **kwargs)
Returns the pointwise union of the two geometries.
GeoWithin
GeoWithin(self, **kwargs)
Returns True if the geometry A is completely inside geometry B.
GeoX
GeoX(self, **kwargs)
Return the X coordinate of the point, or NULL if not available.
Input must be a point
GeoXMax
GeoXMax(self, **kwargs)
Returns X maxima of a bounding box 2d or 3d or a geometry.
GeoXMin
GeoXMin(self, **kwargs)
Returns Y minima of a bounding box 2d or 3d or a geometry.
GeoY
GeoY(self, **kwargs)
Return the Y coordinate of the point, or NULL if not available.
Input must be a point
GeoYMax
GeoYMax(self, **kwargs)
Returns Y maxima of a bounding box 2d or 3d or a geometry.
GeoYMin
GeoYMin(self, **kwargs)
Returns Y minima of a bounding box 2d or 3d or a geometry.
Construct an aggregate user-defined function that is built-in to the backend.
Parameters
Name
Type
Description
Default
fn
The function to wrap.
None
name
The name of the UDF in the backend if different from the function name.
None
database
The database in which the builtin function resides.
None
catalog
The catalog in which the builtin function resides.
None
signature
If present, a tuple of the form ((arg0type, arg1type, ...), returntype). For example, a function taking an int and a float and returning a string would be ((int, float), str). If not present, the signature will be derived from the type annotations of the wrapped function.
None
kwargs
Additional backend-specific configuration arguments for the UDF.
{}
Examples
>>>import ibis>>> ibis.options.interactive =True>>>@ibis.udf.agg.builtin... def favg(a: float) ->float:... '''Compute the average of a column using Kahan summation.'''>>> t = ibis.examples.penguins.fetch()>>> favg(t.bill_length_mm)
┌──────────┐
│ 43.92193 │
└──────────┘
scalar
scalar()
Scalar user-defined functions.
The scalar class itself is not a public API, its methods are.
Construct a scalar user-defined function that is built-in to the backend.
Parameters
Name
Type
Description
Default
fn
The function to wrap.
None
name
The name of the UDF in the backend if different from the function name.
None
database
The database in which the builtin function resides.
None
catalog
The catalog in which the builtin function resides.
None
signature
If present, a tuple of the form ((arg0type, arg1type, ...), returntype). For example, a function taking an int and a float and returning a string would be ((int, float), str). If not present, the signature will be derived from the type annotations of the wrapped function. For builtin UDFs, only the return type annotation is required. See the user guide for more information.
None
kwargs
Additional backend-specific configuration arguments for the UDF.
{}
Examples
>>>import ibis>>>@ibis.udf.scalar.builtin... def hamming(a: str, b: str) ->int:... '''Compute the Hamming distance between two strings.'''>>> expr = hamming("duck", "luck")>>> con = ibis.connect("duckdb://")>>> con.execute(expr)
Construct a vectorized scalar user-defined function that accepts pandas Series’ as inputs.
Parameters
Name
Type
Description
Default
fn
The function to wrap.
None
name
The name of the UDF in the backend if different from the function name.
None
database
The database in which to create the UDF.
None
catalog
The catalog in which to create the UDF.
None
signature
If present, a tuple of the form ((arg0type, arg1type, ...), returntype). For example, a function taking an int and a float and returning a string would be ((int, float), str). If not present, the signature will be derived from the type annotations of the wrapped function.
None
kwargs
Additional backend-specific configuration arguments for the UDF.
{}
Examples
>>>import ibis>>> ibis.options.interactive =True>>> t = ibis.memtable(dict(int_col=[1, 2, 3], str_col=["a", "b", "c"]))>>> t┏━━━━━━━━━┳━━━━━━━━━┓┃ int_col ┃ str_col ┃┡━━━━━━━━━╇━━━━━━━━━┩│ int64 │ string │├─────────┼─────────┤│ 1 │ a ││ 2 │ b ││ 3 │ c │└─────────┴─────────┘>>>@ibis.udf.scalar.pandas... def str_cap(x: str) ->str:... # note usage of pandas `str` method... return x.str.capitalize()>>> str_cap(t.str_col) # doctest: +SKIP┏━━━━━━━━━━━━━━━━━━━━━━━┓┃ string_cap_0(str_col) ┃┡━━━━━━━━━━━━━━━━━━━━━━━┩│ string │├───────────────────────┤│ A ││ B ││ C │└───────────────────────┘
Construct a vectorized scalar user-defined function that accepts PyArrow Arrays as input.
Parameters
Name
Type
Description
Default
fn
The function to wrap.
None
name
The name of the UDF in the backend if different from the function name.
None
database
The database in which to create the UDF.
None
catalog
The catalog in which to create the UDF.
None
signature
If present, a tuple of the form ((arg0type, arg1type, ...), returntype). For example, a function taking an int and a float and returning a string would be ((int, float), str). If not present, the signature will be derived from the type annotations of the wrapped function.
None
kwargs
Additional backend-specific configuration arguments for the UDF.
Construct a non-vectorized scalar user-defined function that accepts Python scalar values as inputs.
python UDFs are likely to be slow
python UDFs are not vectorized: they are executed row by row with one Python function call per row
This calling pattern tends to be much slower than pandas or pyarrow-based vectorized UDFs.
Parameters
Name
Type
Description
Default
fn
The function to wrap.
None
name
The name of the UDF in the backend if different from the function name.
None
database
The database in which to create the UDF.
None
catalog
The catalog in which to create the UDF.
None
signature
If present, a tuple of the form ((arg0type, arg1type, ...), returntype). For example, a function taking an int and a float and returning a string would be ((int, float), str). If not present, the signature will be derived from the type annotations of the wrapped function.
None
kwargs
Additional backend-specific configuration arguments for the UDF.
{}
Examples
>>>import ibis>>> ibis.options.interactive =True>>> t = ibis.memtable(dict(int_col=[1, 2, 3], str_col=["a", "b", "c"]))>>> t
┏━━━━━━━━━┳━━━━━━━━━┓
┃ int_col ┃ str_col ┃
┡━━━━━━━━━╇━━━━━━━━━┩
│ int64 │ string │
├─────────┼─────────┤
│ 1 │ a │
│ 2 │ b │
│ 3 │ c │
└─────────┴─────────┘