<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>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<p dir="auto"><a href="http://stackoverflow.com/questions/32750970/python-pandas-merge-causing-memory-overflow" rel="nofollow">http://stackoverflow.com/questions/32750970/python-pandas-merge-causing-memory-overflow</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# coding: utf-8
import pandas as pd
data = pd.read_csv('https://gist.githubusercontent.com/xgdgsc/8671a22136e1da937f1046a5f211c0ff/raw/d261706a6e7d1d7014e45e47122ead71e7159ef4/small.csv', index_col='&lt;Date&gt;')
print(data.shape)
another = data[[ ' &lt;Open&gt;']]
joined = data.join([another])
print(joined.shape)"><pre class="notranslate"><code class="notranslate"># coding: utf-8
import pandas as pd
data = pd.read_csv('https://gist.githubusercontent.com/xgdgsc/8671a22136e1da937f1046a5f211c0ff/raw/d261706a6e7d1d7014e45e47122ead71e7159ef4/small.csv', index_col='&lt;Date&gt;')
print(data.shape)
another = data[[ ' &lt;Open&gt;']]
joined = data.join([another])
print(joined.shape)
</code></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Currently having  index with duplicate keys when joining dataframes would cause severe memory overflow, sometimes freezes the computer and user has to hard reboot, which can be disastrous for unsaved work.</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">Adding a simple checking before joining/merging , stop the operation and warn the user would be enough.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
<p dir="auto">pandas: 0.18.1<br>
nose: 1.3.7<br>
pip: 8.1.2<br>
setuptools: 27.2.0<br>
Cython: 0.24.1<br>
numpy: 1.11.1<br>
scipy: 0.18.1<br>
statsmodels: 0.6.1<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: 1.4.6<br>
patsy: 0.4.1<br>
dateutil: 2.5.3<br>
pytz: 2016.6.1<br>
blosc: None<br>
bottleneck: 1.1.0<br>
tables: 3.2.2<br>
numexpr: 2.6.1<br>
matplotlib: 1.5.3<br>
openpyxl: 2.3.2<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.3<br>
lxml: 3.6.4<br>
bs4: 4.5.1<br>
html5lib: None<br>
httplib2: None<br>
apiclient: None<br>
sqlalchemy: 1.0.13<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.8<br>
boto: 2.42.0<br>
pandas_datareader: None</p>
</details>