Assignment of column via .loc for numpy non-ns datetimes
- [x] closes #27395 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Looks like there are still some CI failures. Do you need help looking into
them?

On Wed, Aug 21, 2019 at 10:25 AM Jihyung Moon <notifications@github.com>
wrote:

> *@inmoonlight* commented on this pull request.
> ------------------------------
>
> In pandas/core/dtypes/cast.py
> <https://github.com/pandas-dev/pandas/pull/27928#discussion_r316249730>:
>
> > @@ -1055,7 +1055,7 @@ def maybe_cast_to_datetime(value, dtype, errors="raise"):
>                      )
>
>              if is_scalar(value):
> -                if value == iNaT or isna(value):
> +                if value is iNaT or isna(value):
>
> @TomAugspurger <https://github.com/TomAugspurger>
> Restored it.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27928?email_source=notifications&email_token=AAKAOITQBERVCNCF3RMLKI3QFVM7XA5CNFSM4IL3XFI2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCCIBNBQ#discussion_r316249730>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOISVG63DGWO27U3CKWTQFVM7XANCNFSM4IL3XFIQ>
> .
>
 @TomAugspurger 

Desperately...

I looked into several CI issues and found they all raise the same error.

```
=================================== FAILURES ===================================
_ TestSeriesConstructors.test_constructor_generic_timestamp_bad_frequency[m8[ps]-cannot convert timedeltalike] _
[gw0] linux -- Python 3.7.4 /home/travis/miniconda3/envs/pandas-dev/bin/python
self = <pandas.tests.series.test_constructors.TestSeriesConstructors object at 0x7f2b6f5c2910>
dtype = 'm8[ps]', msg = 'cannot convert timedeltalike'
    @pytest.mark.parametrize(
        "dtype,msg",
        [
            ("m8[ps]", "cannot convert timedeltalike"),
            ("M8[ps]", "cannot convert datetimelike"),
        ],
    )
    def test_constructor_generic_timestamp_bad_frequency(self, dtype, msg):
        # see gh-15524, gh-15987
    
        with pytest.raises(TypeError, match=msg):
>           Series([], dtype=dtype)
E           Failed: DID NOT RAISE <class 'TypeError'>
pandas/tests/series/test_constructors.py:1363: Failed
_ TestSeriesConstructors.test_constructor_generic_timestamp_bad_frequency[M8[ps]-cannot convert datetimelike] _
[gw0] linux -- Python 3.7.4 /home/travis/miniconda3/envs/pandas-dev/bin/python
self = <pandas.tests.series.test_constructors.TestSeriesConstructors object at 0x7f2b6f5df750>
dtype = 'M8[ps]', msg = 'cannot convert datetimelike'
    @pytest.mark.parametrize(
        "dtype,msg",
        [
            ("m8[ps]", "cannot convert timedeltalike"),
            ("M8[ps]", "cannot convert datetimelike"),
        ],
    )
    def test_constructor_generic_timestamp_bad_frequency(self, dtype, msg):
        # see gh-15524, gh-15987
    
        with pytest.raises(TypeError, match=msg):
>           Series([], dtype=dtype)
E           Failed: DID NOT RAISE <class 'TypeError'>
pandas/tests/series/test_constructors.py:1363: Failed
``` 

At first glance, I thought pandas does not support [ps] level. This led to https://github.com/pandas-dev/pandas/pull/27928/commits/98a5061bbcc04bb6114cbf1bf69efe15f0e66432 .

How could I solve it? > At first glance, I thought pandas does not support [ps] level.

That's correct. I think if the user explicitly requests `[ps]` we raise, and if we're giving a `[ps]`-resolution array we convert to `[ns]` (is that correct @jbrockmendel?) I think that's right.  xref #23571 @TomAugspurger 

So,,, raising ValueError when allocating [ps] resolution is an issue to be solved...
Which means `pandas/tests/series/test_constructors.py:1363` can be removed?

Am I right? 🤔
 > Which means pandas/tests/series/test_constructors.py:1363 can be removed?

IIUC, I think that should stay. I think these are the expected behaviors

```python
>>> pd.Series([], dtype='datetime64[ps]')                                    # raises
>>> pd.Series(np.array([], dtype='datetime64[ps]'), dtype='datetime64[ps]')  # raises
>>> pd.Series(np.array([], dtype='datetime64[ps]'))                          # OK
``` @TomAugspurger 

Thanks for the explanations!
The final modification raises an error on those inputs.
Still more modification required?  thanks @inmoonlight 