piper.custom.add_xl_formula¶
-
piper.custom.add_xl_formula(df: pandas.core.frame.DataFrame, column_name: str = 'xl_calc', formula: str = '=CONCATENATE(A{row}, B{row}, C{row})', offset: int = 2) → pandas.core.frame.DataFrame[source]¶ add Excel (xl) formula column
- Parameters
df – pandas dataframe
column_name – the column name to be associated with the column formula values, default ‘xl_calc’
formula –
Excel formula to be applied. As an example:
'=CONCATENATE(A{row}, B{row}, C{row})'
where {row} is the defined replacement variable which will be replaced with actual individual row value.
offset – starting row value, default = 2 (resultant xl sheet includes headers)
Examples
formula = '=CONCATENATE(A{row}, B{row}, C{row})' add_xl_formula(df, column_name='X7', formula=formula)
- Returns
- Return type
pandas dataframe