<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Your code here

In [8]: pd.to_timedelta('1', unit='h')
Out[8]: Timedelta('0 days 00:00:00.000000')
"><pre class="notranslate"><span class="pl-c"># Your code here</span>

<span class="pl-v">In</span> [<span class="pl-c1">8</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">to_timedelta</span>(<span class="pl-s">'1'</span>, <span class="pl-s1">unit</span><span class="pl-c1">=</span><span class="pl-s">'h'</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">8</span>]: <span class="pl-v">Timedelta</span>(<span class="pl-s">'0 days 00:00:00.000000'</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">I would expect all the following to return Timedelta('0 days 01:00:00').  pd.to_timedelta(1, unit='h') does not.  I must first cast the string '1' to a int or float then to a timedelta.</p>
<p dir="auto">In [6]: pd.to_timedelta(1.0, unit='h')<br>
Out[6]: Timedelta('0 days 01:00:00')</p>
<p dir="auto">In [7]: pd.to_timedelta(1, unit='h')<br>
Out[7]: Timedelta('0 days 01:00:00')</p>
<p dir="auto">In [8]: pd.to_timedelta('1', unit='h')<br>
Out[8]: Timedelta('0 days 00:00:00.000000')</p>
<p dir="auto">In [9]: pd.to_timedelta('1 H')<br>
Out[9]: Timedelta('0 days 01:00:00')</p>
<h4 dir="auto">Expected Output</h4>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
# Paste the output here pd.show_versions() here
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.1.final.0<br>
python-bits: 64<br>
OS: Windows<br>
OS-release: 10<br>
machine: AMD64<br>
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.20.2<br>
pytest: 3.1.2<br>
pip: 9.0.1<br>
setuptools: 27.2.0<br>
Cython: 0.25.2<br>
numpy: 1.12.1<br>
scipy: 0.19.0<br>
xarray: None<br>
IPython: 6.0.0<br>
sphinx: None<br>
patsy: 0.4.1<br>
dateutil: 2.6.0<br>
pytz: 2016.10<br>
blosc: None<br>
bottleneck: None<br>
tables: 3.2.2<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.0<br>
openpyxl: None<br>
xlrd: 1.0.0<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: 4.5.3<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.1.5<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.4<br>
s3fs: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">So, I don't know if this is by design, but it sure confused me. <code class="notranslate">to_timedelta()</code> operates differently on the number <code class="notranslate">1000</code> compared to the string <code class="notranslate">'1000'</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In[3]: pd.to_timedelta(1000, unit='ms')
Out[3]: Timedelta('0 days 00:00:01')
In[4]: pd.to_timedelta(1000.0, unit='ms')
Out[4]: Timedelta('0 days 00:00:01')"><pre class="notranslate"><span class="pl-v">In</span>[<span class="pl-c1">3</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">to_timedelta</span>(<span class="pl-c1">1000</span>, <span class="pl-s1">unit</span><span class="pl-c1">=</span><span class="pl-s">'ms'</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">3</span>]: <span class="pl-v">Timedelta</span>(<span class="pl-s">'0 days 00:00:01'</span>)
<span class="pl-v">In</span>[<span class="pl-c1">4</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">to_timedelta</span>(<span class="pl-c1">1000.0</span>, <span class="pl-s1">unit</span><span class="pl-c1">=</span><span class="pl-s">'ms'</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">4</span>]: <span class="pl-v">Timedelta</span>(<span class="pl-s">'0 days 00:00:01'</span>)</pre></div>
<p dir="auto">and</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In[6]: pd.to_timedelta('1000ms')
Out[6]: Timedelta('0 days 00:00:01')"><pre class="notranslate"><span class="pl-v">In</span>[<span class="pl-c1">6</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">to_timedelta</span>(<span class="pl-s">'1000ms'</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">6</span>]: <span class="pl-v">Timedelta</span>(<span class="pl-s">'0 days 00:00:01'</span>)</pre></div>
<p dir="auto">while</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In[5]: pd.to_timedelta('1000', unit='ms')
Out[5]: Timedelta('0 days 00:00:00.000001')"><pre class="notranslate"><span class="pl-v">In</span>[<span class="pl-c1">5</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">to_timedelta</span>(<span class="pl-s">'1000'</span>, <span class="pl-s1">unit</span><span class="pl-c1">=</span><span class="pl-s">'ms'</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">5</span>]: <span class="pl-v">Timedelta</span>(<span class="pl-s">'0 days 00:00:00.000001'</span>)</pre></div>
<p dir="auto">I've tried my best to come up with a reason for why this behaviour would be desirable, but I can't think of any.</p>