Pandas recalculate index after a concatenation : <p>I have a problem where I produce a pandas dataframe by concatenating along the row axis (stacking vertically). </p>

<p>Each of the constituent dataframes has an autogenerated index (ascending numbers). </p>

<p>After concatenation, my index is screwed up: it counts up to n (where n is the shape[0] of the corresponding dataframe), and restarts at zero at the next dataframe. </p>

<p>I am trying to "re-calculate the index, given the current order", or "re-index" (or so I thought).  Turns out that isn't exactly what <code>DataFrame.reindex</code> seems to be doing. </p>

<hr>

<p>Here is what I tried to do:</p>

<pre><code>train_df = pd.concat(train_class_df_list)
train_df = train_df.reindex(index=[i for i in range(train_df.shape[0])])
</code></pre>

<p>It failed with "cannot reindex from a duplicate axis." I don't want to change the order of my data... just need to delete the old index and set up a new one, with the order of rows preserved. </p>
