Repository: pandas-dev/pandas

Issue:
Comparing Timedelta and NaT gives inconsistent results depending on order
#### Code Sample, a copy-pastable example if possible

```python
In [1]: import pandas as pd                                                                                                                                                 

In [2]: pd.Timedelta(0) > pd.Timedelta(None)                                              
TypeError: Cannot compare type Timedelta with type NaTType

In [3]: pd.Timedelta(None) < pd.Timedelta(0)                                                                                                                                            
Out[3]: False

```
#### Problem description

I would expect the result of `a < b` to be the same as that of `b > a` but in this case one returns `False` and the other raises `TypeError`.

Related issue: #24983 "Separate NaT values for Timedelta and Period" - if `pd.Timedelta(None)` gave a value of type `Timedelta` then maybe this error would not have occurred.

#### Expected Output

Either both `False` or both `TypeError` (both `False` would be more helpful)

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit: None
python: 3.6.8.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-46-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8

pandas: 0.24.2
pytest: 4.3.1
pip: 19.0.3
setuptools: 40.8.0
Cython: 0.29.5
numpy: 1.16.2
scipy: None
pyarrow: None
xarray: 0.11.3
IPython: 7.3.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2018.9
blosc: None
bottleneck: None
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.2.18
pymysql: None
psycopg2: 2.7.6.1 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

</details>



Discussion:
N.B. `Timedelta == NaT` and `NaT == Timedelta` both return `False`
pls check this on master, this has been sustantially reworked
On master 6d9b702a661891724e6c10dd96eb149404205c67 I get the same problem. 
```python
>>> pd.Timedelta(None) > pd.Timedelta(0)
False
>>> pd.Timedelta(0) > pd.Timedelta(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pandas/_libs/tslibs/timedeltas.pyx", line 786, in pandas._libs.tslibs.timedeltas._Timedelta.__richcmp__
TypeError: Cannot compare type Timedelta with type NaTType
```

Also `pd.show_versions()` raises an error:
```python
>>> pd.show_versions()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/.conda/envs/pandas-dev/lib/python3.7/site-packages/pandas/util/_print_versions.py", line 109, in show_versions
    ver = ver_f(mod)
  File "~/.conda/envs/pandas-dev/lib/python3.7/site-packages/pandas/util/_print_versions.py", line 72, in <lambda>
    ("xarray", lambda mod: mod.__version__),
AttributeError: module 'xarray' has no attribute '__version__'
>>> pd.__version__
'0.21.0.dev+4045.g6d9b702a6'
```

Resolving patch:
diff --git a/pandas/conftest.py b/pandas/conftest.py
--- a/pandas/conftest.py
+++ b/pandas/conftest.py
@@ -218,6 +218,19 @@ def all_compare_operators(request):
     return request.param
 
 
+@pytest.fixture(params=['__le__', '__lt__', '__ge__', '__gt__'])
+def compare_operators_no_eq_ne(request):
+    """
+    Fixture for dunder names for compare operations except == and !=
+
+    * >=
+    * >
+    * <
+    * <=
+    """
+    return request.param
+
+
 @pytest.fixture(params=[None, 'gzip', 'bz2', 'zip', 'xz'])
 def compression(request):
     """


Test patch:
diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py
--- a/pandas/tests/scalar/test_nat.py
+++ b/pandas/tests/scalar/test_nat.py
@@ -348,3 +348,12 @@ def test_to_numpy_alias():
     result = NaT.to_numpy()
 
     assert isna(expected) and isna(result)
+
+
+@pytest.mark.parametrize("other", [
+    Timedelta(0), Timestamp(0)
+])
+def test_nat_comparisons(compare_operators_no_eq_ne, other):
+    # GH 26039
+    assert getattr(NaT, compare_operators_no_eq_ne)(other) is False
+    assert getattr(other, compare_operators_no_eq_ne)(NaT) is False