Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/expectations/metrics/map_metric.py b/great_expectations/expectations/metrics/map_metric.py
--- a/great_expectations/expectations/metrics/map_metric.py
+++ b/great_expectations/expectations/metrics/map_metric.py
@@ -670,25 +670,27 @@ def _pandas_map_condition_index(
         "filter_column_isnull", getattr(cls, "filter_column_isnull", False)
     )
 
-    column_name = accessor_domain_kwargs["column"]
+    if "column" in accessor_domain_kwargs:
+        column_name = accessor_domain_kwargs["column"]
 
-    if column_name not in metrics["table.columns"]:
-        raise ge_exceptions.ExecutionEngineError(
-            message=f'Error: The column "{column_name}" in BatchData does not exist.'
-        )
+        if column_name not in metrics["table.columns"]:
+            raise ge_exceptions.ExecutionEngineError(
+                message=f'Error: The column "{column_name}" in BatchData does not exist.'
+            )
 
-    if filter_column_isnull:
-        df = df[df[column_name].notnull()]
+        if filter_column_isnull:
+            df = df[df[column_name].notnull()]
 
     result_format = metric_value_kwargs["result_format"]
+
     if result_format["result_format"] == "COMPLETE":
         return list(df[boolean_mapped_unexpected_values].index)
-    else:
-        return list(
-            df[boolean_mapped_unexpected_values].index[
-                : result_format["partial_unexpected_count"]
-            ]
-        )
+
+    return list(
+        df[boolean_mapped_unexpected_values].index[
+            : result_format["partial_unexpected_count"]
+        ]
+    )
 
 
 def _pandas_column_map_condition_value_counts(
@@ -789,23 +791,25 @@ def _pandas_map_condition_rows(
         "filter_column_isnull", getattr(cls, "filter_column_isnull", False)
     )
 
-    column_name = accessor_domain_kwargs["column"]
+    if "column" in accessor_domain_kwargs:
+        column_name = accessor_domain_kwargs["column"]
 
-    if column_name not in metrics["table.columns"]:
-        raise ge_exceptions.ExecutionEngineError(
-            message=f'Error: The column "{column_name}" in BatchData does not exist.'
-        )
+        if column_name not in metrics["table.columns"]:
+            raise ge_exceptions.ExecutionEngineError(
+                message=f'Error: The column "{column_name}" in BatchData does not exist.'
+            )
 
-    if filter_column_isnull:
-        df = df[df[column_name].notnull()]
+        if filter_column_isnull:
+            df = df[df[column_name].notnull()]
 
     result_format = metric_value_kwargs["result_format"]
+
     if result_format["result_format"] == "COMPLETE":
         return df[boolean_mapped_unexpected_values]
-    else:
-        return df[boolean_mapped_unexpected_values][
-            result_format["partial_unexpected_count"]
-        ]
+
+    return df[boolean_mapped_unexpected_values][
+        result_format["partial_unexpected_count"]
+    ]
 
 
 def _sqlalchemy_map_condition_unexpected_count_aggregate_fn(


Test patch: