cycquery.ops.AddNumericΒΆ
- class AddNumeric(add_to, add, new_col_labels=None)[source]ΒΆ
Bases:
QueryOp
Add a numeric value to some columns.
- Parameters:
add_to (
Union
[str
,List
[str
]]) β Column names specifying to which columns is being added.add (
Union
[int
,float
,List
[int
],List
[float
]]) β Adds this value to the add_to columns.new_col_labels (
Union
[str
,List
[str
],None
]) β If specified, create new columns with these labels. Otherwise, apply the function to the existing columns.
Examples
>>> AddNumeric("col1", 1)(table) >>> AddNumeric(["col1", "col2"], 1)(table) >>> AddNumeric("col1", 1, "col1_plus_1")(table) >>> AddNumeric(["col1", "col2"], 1, ["col1_plus_1", "col2_plus_1"])(table) >>> AddNumeric(["col1", "col2"], [1, 2.2])(table)
Methods