Repository: NeurodataWithoutBorders/nwbinspector (language: python)

Issue:
[Bug]: Unclear error message from `check_col_not_nan` check
### What happened?

I ran NWBinspector on some files, and got an unclear error message from the `check_col_not_nan` check, which was raised as an error. From some detective work, we realized this is because in an Electrode Table I do have a column of all NaN (as a placeholder, I had filled the impendences with NaN). 

NWBinspector is right to flag this, but it seems to have trouble reporting this in a clear way, and prints out this long error stack, from which it is tricky to figure out which table / column raised the error. If possible, it would be nice if this error could be caught in a way to be more clear about what the issue is:

<img width="1183" alt="Screen Shot 2022-07-26 at 6 00 46 PM" src="https://user-images.githubusercontent.com/7727566/181119967-2cc3c1f1-4dd9-443f-8204-e970d12e1dd6.png">



### Steps to Reproduce

```shell
This happened from an NWB file with a column of NaNs. If you need a test file, I can make and add one.
```


### Traceback

_No response_

### Operating System

macOS

### Python Executable

Conda

### Python Version

3.8

### Usage

Command Line Interface

### Were you streaming with ROS3?

No

### Package Versions

_No response_

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/NeurodataWithoutBorders/nwbinspector/blob/dev/.github/CODE_OF_CONDUCT.rst)
- [X] Have you ensured this bug was not already [reported](https://github.com/neurodatawithoutborders/nwbinspector/issues)?
- [X] To the best of your ability, have you ensured this is a bug within the code that checks the NWBFile, rather than a bug in the NWBFile reader (e.g., [PyNWB](https://github.com/NeurodataWithoutBorders/pynwb) or [MatNWB](https://github.com/NeurodataWithoutBorders/matnwb))?


Discussion / hints:

Fix patch:
diff --git a/nwbinspector/checks/tables.py b/nwbinspector/checks/tables.py
index df83a3bb5..00ab7c19d 100644
--- a/nwbinspector/checks/tables.py
+++ b/nwbinspector/checks/tables.py
@@ -194,16 +194,17 @@ def check_table_values_for_dict(table: DynamicTable, nelems: int = 200):
 def check_col_not_nan(table: DynamicTable, nelems: Optional[int] = 200):
     """Check if all of the values in a single column of a table are NaN."""
     for column in table.columns:
-        if not hasattr(column, "data") or isinstance(column, VectorIndex) or isinstance(column.data[0], str):
+        if (
+            not hasattr(column, "data")
+            or isinstance(column, VectorIndex)
+            or not np.issubdtype(np.array(column[0]).dtype, np.floating)
+        ):
             continue
         if nelems is not None and not all(np.isnan(column[:nelems]).flatten()):
             continue
 
-        if all(
-            np.isnan(
-                column[slice(0, None, np.ceil(len(column.data) / nelems).astype(int) if nelems else None)]
-            ).flatten()
-        ):
-            yield InspectorMessage(
-                message=f"Column {column.name} has all NaN values. Consider removing it from the table."
-            )
+        slice_by = np.ceil(len(column.data) / nelems).astype(int) if nelems else None
+        message = f"Column '{column.name}' might have all NaN values. Consider removing it from the table."
+        message = message.replace("might have", "has") if nelems is None or slice_by == 1 else message
+        if all(np.isnan(column[slice(0, None, slice_by)]).flatten()):
+            yield InspectorMessage(message=message)


Test patch:
diff --git a/tests/unit_tests/test_tables.py b/tests/unit_tests/test_tables.py
index d25f98483..dc711c231 100644
--- a/tests/unit_tests/test_tables.py
+++ b/tests/unit_tests/test_tables.py
@@ -338,16 +338,17 @@ def test_check_col_not_nan_pass():
 
 
 def test_check_col_not_nan_fail():
+    """Addition of test_integer_type included from issue 241."""
     table = DynamicTable(name="test_table", description="")
-    for name in ["test_column_not_nan_1", "test_column_nan_1", "test_column_not_nan_2", "test_column_nan_2"]:
+    for name in ["test_column_not_nan_1", "test_column_nan_1", "test_integer_type", "test_column_nan_2"]:
         table.add_column(name=name, description="")
     for _ in range(400):
         table.add_row(
-            test_column_not_nan_1=1.0, test_column_nan_1=np.nan, test_column_not_nan_2=1.0, test_column_nan_2=np.nan
+            test_column_not_nan_1=1.0, test_column_nan_1=np.nan, test_integer_type=1, test_column_nan_2=np.nan
         )
     assert check_col_not_nan(table=table) == [
         InspectorMessage(
-            message="Column test_column_nan_1 has all NaN values. Consider removing it from the table.",
+            message="Column 'test_column_nan_1' might have all NaN values. Consider removing it from the table.",
             importance=Importance.BEST_PRACTICE_SUGGESTION,
             check_function_name="check_col_not_nan",
             object_type="DynamicTable",
@@ -356,7 +357,38 @@ def test_check_col_not_nan_fail():
             file_path=None,
         ),
         InspectorMessage(
-            message="Column test_column_nan_2 has all NaN values. Consider removing it from the table.",
+            message="Column 'test_column_nan_2' might have all NaN values. Consider removing it from the table.",
+            importance=Importance.BEST_PRACTICE_SUGGESTION,
+            check_function_name="check_col_not_nan",
+            object_type="DynamicTable",
+            object_name="test_table",
+            location="/",
+            file_path=None,
+        ),
+    ]
+
+
+def test_check_col_not_nan_fail_span_all_data():
+    """Addition of test_integer_type included from issue 241."""
+    table = DynamicTable(name="test_table", description="")
+    for name in ["test_column_not_nan_1", "test_column_nan_1", "test_integer_type", "test_column_nan_2"]:
+        table.add_column(name=name, description="")
+    for _ in range(180):
+        table.add_row(
+            test_column_not_nan_1=1.0, test_column_nan_1=np.nan, test_integer_type=1, test_column_nan_2=np.nan
+        )
+    assert check_col_not_nan(table=table) == [
+        InspectorMessage(
+            message="Column 'test_column_nan_1' has all NaN values. Consider removing it from the table.",
+            importance=Importance.BEST_PRACTICE_SUGGESTION,
+            check_function_name="check_col_not_nan",
+            object_type="DynamicTable",
+            object_name="test_table",
+            location="/",
+            file_path=None,
+        ),
+        InspectorMessage(
+            message="Column 'test_column_nan_2' has all NaN values. Consider removing it from the table.",
             importance=Importance.BEST_PRACTICE_SUGGESTION,
             check_function_name="check_col_not_nan",
             object_type="DynamicTable",