n-dataframes inner joined to final dataframe
<p>I'm trying to figure out how to inner merge n-dataframes to a single final dataframe.</p>

<p>I need to be able to specify a list of dataframes in which the inner join of <strong>all</strong> is output as another dataframe. Again, the exact number will not be known in advance, but the integer count can be.</p>

<p>See the below code:</p>

<pre><code>import pandas as pd


result = pd.merge(df_1, df_2, on=['Col1', 'Col2', 'Col3', 'Col4'], how='inner')
result_2 = pd.merge(df_3, df_4, on=['Col1', 'Col2', 'Col3', 'Col4'], how='inner')
result_final = pd.merge(result, result_2, on=['Col1', 'Col2', 'Col3', 'Col4'], how='inner')
</code></pre>

<pre><code>cols = ['Col1', 'Col2', 'Col3', 'Col4']

pd.concat([d.set_index(cols) for d in [df_1, df_2, df_3, df_4]], axis=1)
</code></pre>

python pandas