<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="import io
import pandas
csv_file = io.StringIO(&quot;&quot;&quot;datetime,cloudcover_eddh,dewpoint,dewpoint_eddh,humidity,humidity_eddh,lat,lon,precipitation_eddh,pressure_eddh,temperature,temperature_eddh,winddirection_eddh,windgust_eddh,windspeed_eddh
2016-01-01 00:00:00,CAVOC,4.1,3.0,100.0,94.0,53.5443,9.926839999999999,,1023.0,4.1,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,1.7,3.0,96.0,94.0,53.61297,9.98145,,1023.0,2.3,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,2.4,3.0,98.0,94.0,53.57735,10.09428,,1023.0,2.7,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,3.0,3.0,94.0,94.0,53.68849,10.1335,,1023.0,3.9,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,4.2,3.0,76.0,94.0,53.6608,10.06555,,1023.0,,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,3.0,3.0,100.0,94.0,53.43252,10.297989999999999,,1023.0,3.0,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,1.9,3.0,92.0,94.0,53.68937,10.13025,,1023.0,3.1,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,3.5,3.0,100.0,94.0,53.6344,9.966560000000001,,1023.0,3.5,3.0,160.0,0.0,7.2
2016-01-01 00:00:00,CAVOC,3.6,3.0,99.0,94.0,53.46402,9.89157,,1023.0,3.7,3.0,160.0,0.0,7.2&quot;&quot;&quot;)
data_df = pandas.read_csv(csv_file, parse_dates=[&quot;datetime&quot;], index_col=&quot;datetime&quot;)
cloud_cover_df = pandas.get_dummies(data_df.cloudcover_eddh, prefix=&quot;cloudcover_eddh&quot;)
df_hour = pandas.get_dummies(data_df.index.hour, prefix=&quot;hour&quot;)
data_df.reset_index(inplace=True, drop=True)
data_df = pandas.concat([
   data_df,
   df_hour,
    cloud_cover_df
], axis=1, ignore_index=True)
"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">io</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span>
<span class="pl-s1">csv_file</span> <span class="pl-c1">=</span> <span class="pl-s1">io</span>.<span class="pl-v">StringIO</span>(<span class="pl-s">"""datetime,cloudcover_eddh,dewpoint,dewpoint_eddh,humidity,humidity_eddh,lat,lon,precipitation_eddh,pressure_eddh,temperature,temperature_eddh,winddirection_eddh,windgust_eddh,windspeed_eddh</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,4.1,3.0,100.0,94.0,53.5443,9.926839999999999,,1023.0,4.1,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,1.7,3.0,96.0,94.0,53.61297,9.98145,,1023.0,2.3,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,2.4,3.0,98.0,94.0,53.57735,10.09428,,1023.0,2.7,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,3.0,3.0,94.0,94.0,53.68849,10.1335,,1023.0,3.9,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,4.2,3.0,76.0,94.0,53.6608,10.06555,,1023.0,,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,3.0,3.0,100.0,94.0,53.43252,10.297989999999999,,1023.0,3.0,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,1.9,3.0,92.0,94.0,53.68937,10.13025,,1023.0,3.1,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,3.5,3.0,100.0,94.0,53.6344,9.966560000000001,,1023.0,3.5,3.0,160.0,0.0,7.2</span>
<span class="pl-s">2016-01-01 00:00:00,CAVOC,3.6,3.0,99.0,94.0,53.46402,9.89157,,1023.0,3.7,3.0,160.0,0.0,7.2"""</span>)
<span class="pl-s1">data_df</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-en">read_csv</span>(<span class="pl-s1">csv_file</span>, <span class="pl-s1">parse_dates</span><span class="pl-c1">=</span>[<span class="pl-s">"datetime"</span>], <span class="pl-s1">index_col</span><span class="pl-c1">=</span><span class="pl-s">"datetime"</span>)
<span class="pl-s1">cloud_cover_df</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-en">get_dummies</span>(<span class="pl-s1">data_df</span>.<span class="pl-s1">cloudcover_eddh</span>, <span class="pl-s1">prefix</span><span class="pl-c1">=</span><span class="pl-s">"cloudcover_eddh"</span>)
<span class="pl-s1">df_hour</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-en">get_dummies</span>(<span class="pl-s1">data_df</span>.<span class="pl-s1">index</span>.<span class="pl-s1">hour</span>, <span class="pl-s1">prefix</span><span class="pl-c1">=</span><span class="pl-s">"hour"</span>)
<span class="pl-s1">data_df</span>.<span class="pl-en">reset_index</span>(<span class="pl-s1">inplace</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">drop</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-s1">data_df</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-en">concat</span>([
   <span class="pl-s1">data_df</span>,
   <span class="pl-s1">df_hour</span>,
    <span class="pl-s1">cloud_cover_df</span>
], <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">ignore_index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">I expect that the three dataframes are concatenated as wished. I know that the indices correspond so I do not need pandas to check that for me. Instead I get the following error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  File &quot;&lt;stdin&gt;&quot;, line 5, in &lt;module&gt;
  File &quot;/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/reshape/concat.py&quot;, line 207, in concat
    return op.get_result()
  File &quot;/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/reshape/concat.py&quot;, line 401, in get_result
    indexers[ax] = obj_labels.reindex(new_labels)[1]
  File &quot;/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/indexes/base.py&quot;, line 2887, in reindex
    indexer, missing = self.get_indexer_non_unique(target)
  File &quot;/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/indexes/base.py&quot;, line 2708, in get_indexer_non_unique
    indexer, missing = self._engine.get_indexer_non_unique(tgt_values)
  File &quot;pandas/_libs/index.pyx&quot;, line 325, in pandas._libs.index.IndexEngine.get_indexer_non_unique (pandas/_libs/index.c:7722)
TypeError: 'NoneType' object is not iterable"><pre lang="Traceback" class="notranslate"><code class="notranslate">  File "&lt;stdin&gt;", line 5, in &lt;module&gt;
  File "/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/reshape/concat.py", line 207, in concat
    return op.get_result()
  File "/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/reshape/concat.py", line 401, in get_result
    indexers[ax] = obj_labels.reindex(new_labels)[1]
  File "/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/indexes/base.py", line 2887, in reindex
    indexer, missing = self.get_indexer_non_unique(target)
  File "/informatik2/students/home/1kastner/.local/lib/python3.5/site-packages/pandas/core/indexes/base.py", line 2708, in get_indexer_non_unique
    indexer, missing = self._engine.get_indexer_non_unique(tgt_values)
  File "pandas/_libs/index.pyx", line 325, in pandas._libs.index.IndexEngine.get_indexer_non_unique (pandas/_libs/index.c:7722)
TypeError: 'NoneType' object is not iterable
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.5.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.10.0-33-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8<br>
LOCALE: en_US.UTF-8</p>
<p dir="auto">pandas: 0.20.3<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 36.0.1<br>
Cython: None<br>
numpy: 1.13.1<br>
scipy: 0.17.0<br>
xarray: None<br>
IPython: None<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: None<br>
tables: 3.2.2<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 1.5.1<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: 0.7.3<br>
lxml: None<br>
bs4: 4.4.1<br>
html5lib: 0.999<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.8<br>
s3fs: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">When concatting two dataframes where there are a) there are duplicate columns in one of the dataframes, and b) there are non-overlapping column names in both, then you get a IndexError:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [9]: df1 = pd.DataFrame(np.random.randn(3,3), columns=['A', 'A', 'B1'])
   ...: df2 = pd.DataFrame(np.random.randn(3,3), columns=['A', 'A', 'B2'])

In [10]: pd.concat([df1, df2])

Traceback (most recent call last):
  File &quot;&lt;ipython-input-10-f61a1ab4009e&gt;&quot;, line 1, in &lt;module&gt;
    pd.concat([df1, df2])
...
  File &quot;c:\users\vdbosscj\scipy\pandas-joris\pandas\core\index.py&quot;, line 765, in take
    taken = self.view(np.ndarray).take(indexer)
IndexError: index 3 is out of bounds for axis 0 with size 3"><pre class="notranslate"><code class="notranslate">In [9]: df1 = pd.DataFrame(np.random.randn(3,3), columns=['A', 'A', 'B1'])
   ...: df2 = pd.DataFrame(np.random.randn(3,3), columns=['A', 'A', 'B2'])

In [10]: pd.concat([df1, df2])

Traceback (most recent call last):
  File "&lt;ipython-input-10-f61a1ab4009e&gt;", line 1, in &lt;module&gt;
    pd.concat([df1, df2])
...
  File "c:\users\vdbosscj\scipy\pandas-joris\pandas\core\index.py", line 765, in take
    taken = self.view(np.ndarray).take(indexer)
IndexError: index 3 is out of bounds for axis 0 with size 3
</code></pre></div>
<p dir="auto">I don't know if it should work (although I suppose it should, as with only the duplicate columns it does work), but at least the error message is not really helpfull.</p>