I have two text files which contains same data but in different columns and different rows
<p>Example:
First file.txt:</p>

<pre><code>a | b | c | d
0 | 1 | 2 | 3
4 | 5 | 6 | 7
</code></pre>

<p>Second file.txt</p>

<pre><code>c | b | d | a
6 | 5 | 7 | 4
2 | 1 | 3 | 0
</code></pre>

<p>Suggest me some easy way to populate and compare the values.</p>

<p>I would suggest saving them as <code>csv</code> files but text will work as well as long as you specify the correct separator. </p>

<pre><code>import pandas as pd
df1 = pd.read_csv('text1.csv', sep=',')
df2 = pd.read_csv('text2.csv', sep=',')
</code></pre>

<p>you can then sort the columns</p>

<pre><code>df1 = df1.sort_index(axis=1)
df2 = df2.sort_index(axis=1)
</code></pre>

<p>all the columns will now be in the same order.</p>

<p>you can aslo append the 2 DataFrames</p>

<pre><code>df1 = df1.append(df2)
</code></pre>

<p>The <code>pandas</code> has several methods for comparing <code>DataFrames</code></p>

python