zhaoyongjie commented on a change in pull request #15279:
URL: https://github.com/apache/superset/pull/15279#discussion_r658447572
##########
File path: superset/utils/pandas_postprocessing.py
##########
@@ -436,14 +442,68 @@ def diff(df: DataFrame, columns: Dict[str, str], periods:
int = 1,) -> DataFrame
on diff values calculated from `y`, leaving the original column `y`
unchanged.
:param periods: periods to shift for calculating difference.
+ :param axis: 0 for row, 1 for column. default 0.
:return: DataFrame with diffed columns
:raises QueryObjectValidationError: If the request in incorrect
"""
df_diff = df[columns.keys()]
- df_diff = df_diff.diff(periods=periods)
+ df_diff = df_diff.diff(periods=periods, axis=axis)
return _append_columns(df, df_diff, columns)
+@validate_column_args("source_columns", "compare_columns")
+def compare(
+ df: DataFrame,
+ source_columns: List[str],
+ compare_columns: List[str],
+ compare_type: Optional[str],
Review comment:
nice catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]