ENH: Add Timedelta Support to JSON Reader with orient=table (#21140)
- [ ] closes #21140
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=h1) Report
> Merging [#21827](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/be6ad724aac8470ebf9d246bdd322e71d9b80353?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21827/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #21827      +/-   ##
==========================================
+ Coverage   92.05%   92.05%   +<.01%     
==========================================
  Files         170      170              
  Lines       50708    50710       +2     
==========================================
+ Hits        46677    46679       +2     
  Misses       4031     4031
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <100%> (ø)` | :arrow_up: |
| #single | `42.36% <20%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/json/table\_schema.py](https://codecov.io/gh/pandas-dev/pandas/pull/21827/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vdGFibGVfc2NoZW1hLnB5) | `98.31% <100%> (+0.02%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=footer). Last update [be6ad72...0f28fd0](https://codecov.io/gh/pandas-dev/pandas/pull/21827?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 Hello, what is wrong with Travis test? Is it a problem on the testing side or on mine?  Looks like something on the Travis side in this particular instance - @TomAugspurger can you help restart that particular job? restarted.

On Tue, Jul 24, 2018 at 10:23 AM William Ayd <notifications@github.com>
wrote:

> Looks like something on the Travis side in this particular instance -
> @TomAugspurger <https://github.com/TomAugspurger> can you help restart
> that particular job?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/21827#issuecomment-407446721>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIpHh9lD3neA7Yf-jvKy2AexGTWt8ks5uJzwIgaJpZM4VHm9i>
> .
>
 @WillAyd is there anything else that I should change? Hello, @jreback 
How should I proceed with `astype`? Should support for iso-formatted timedeltas be added there?
Now `astype` could not parse timedeltas and datetimes from strings. So, wouldn't it be inconsistent to add support for iso-format? i believe we handle astype for date times by calling to_datetme we should do the same for timedelta (which then would make this automatically work) For now such conversions throw error
```python
>>> s = pd.Series(['0:0:1'])
>>> s.astype('timedelta64[ns]')
WTF timedelta64[ns]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sergey/projects/pandas/pandas/util/_decorators.py", line 178, in wrapper
    return func(*args, **kwargs)
  File "/home/sergey/projects/pandas/pandas/core/generic.py", line 5149, in astype
    **kwargs)
  File "/home/sergey/projects/pandas/pandas/core/internals/managers.py", line 555, in astype
    return self.apply('astype', dtype=dtype, **kwargs)
  File "/home/sergey/projects/pandas/pandas/core/internals/managers.py", line 422, in apply
    applied = getattr(b, f)(**kwargs)
  File "/home/sergey/projects/pandas/pandas/core/internals/blocks.py", line 564, in astype
    **kwargs)
  File "/home/sergey/projects/pandas/pandas/core/internals/blocks.py", line 655, in _astype
    values = astype_nansafe(values.ravel(), dtype, copy=True)
  File "/home/sergey/projects/pandas/pandas/core/dtypes/cast.py", line 717, in astype_nansafe
    return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape)
  File "pandas/_libs/lib.pyx", line 455, in pandas._libs.lib.astype_intsafe
    util.set_value_at_unsafe(result, i, v)
  File "pandas/_libs/src/util.pxd", line 144, in util.set_value_at_unsafe
ValueError: Could not convert object to NumPy timedelta
```
I think the problem is with:
https://github.com/pandas-dev/pandas/blob/114f4153400cd917058a69f79660d18076d9609a/pandas/core/dtypes/cast.py#L712-L723
We're not reaching the line 721 as `np.issubdtype(np.timedelta64, np.integer)` is `True`.
Should I create a new pull request? @fjdiod if you are interested it would be preferable to have a new issue and PR, similar to what you just did for the `to_timedelta` change. Sorry for all of the pre-cursors! Hello, @WillAyd. I've created an issue and a pull request #22100 #22107 can you merge master and update can you merge master and update Closing as stale though would be great to have this. Please ping if you'd like to pick this back up