perform_calculations
Input DataFrame.
Dictionary of calculation instructions where keys are new field names and values are calculation expressions (lists).
Optional mapping of original to renamed columns.
DataFrame with calculations applied and new fields added.
Supported Operations
Arithmetic Operations
+,-,*,/: Basic arithmetic//: Integer division/0: Division with zero-safe handlingmin,max: Element-wise minimum/maximum
Type Conversions
asint,asfloat,asstr: Convert data typesfloor,ceil,round: Rounding operationsabs: Absolute value
String Operations
strip: Strip whitespacestriplzero: Strip leading zerosstripkey: Strip whitespace and leading zerossplit_before,split_after: String splittingsubstr: Substring extractioncontains,contains_case_insensitive: String containsreplace,replace_regex: String replacement
Logical Operations
==,!=: Equality comparisonsand,or,not: Boolean logicwhere: Conditional selection (ternary operator)isin: Membership test
Date/Time Operations
datetime: Parse datetime with format stringdatetimestr: Parse and convert to string
Special Operations
set: Set a valuefillna,fillempty: Fill missing valuesmap: Map values using a dictionarygeo_area: Calculate geometric arearound_nearest: Round to nearest multiple?: Resolve filter expression
Examples
perform_tweaks
Input DataFrame.
List of tweak instructions. Each entry should be a dict with:
field: The field to modifykey: The field to use for matchingvalues: Dict mapping key values to new field values
Optional mapping of original to renamed columns.
DataFrame with tweaks applied.
Example
resolve_filter
filters module and used within calculations for conditional operations.
See the Filters API documentation for detailed information.