concatenate excel datas with python or Excel
<p>Here's my problem, I have an Excel sheet with 2 columns (see below)<a href="http://i.stack.imgur.com/jMLBZ.png" rel="nofollow"><img src="http://i.stack.imgur.com/jMLBZ.png" alt="enter image description here"></a></p>

<p>I'd like to print (on python console or in a excel cell) all the data under this form : </p>

<pre><code> "1" : ["1123","1165", "1143", "1091", "n"], *** n â [A2; A205]***
</code></pre>

<p>We don't really care about the Column B. But I need to add every postal code under this specific form. </p>

<p>is there a way to do it with Excel or in Python with Panda ? (If you have any other ideas I would love to hear them)</p>

<p>Cheers</p>

<p>I am not familiar with excel, but pandas could easily handle this problem.</p>

<p>First, read the excel to a DataFrame</p>

<pre><code>import pandas as pd
df = pd.read_excel(filename)
</code></pre>

<p>Then, print as you like</p>

<pre><code>print({"1": list(df.iloc[0:N]['A'])})
</code></pre>

<p>where <code>N</code> is the amount you would like to print. That is it. If the list is not a string list, you need to cast the int to string.</p>

<p>Also, there are a lot parameters that can control the load part of excel <code>read_excel</code>, you can go through the document to set suitable parameters.</p>

<p>Hope this would be helpful to you.</p>

python excel pandas xlsxwriter