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 think you can use <code>parse_cols</code> for parse first column and then filter out all columns from 205 to 1000 by <code>skiprows</code> in <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_excel.html" rel="nofollow"><code>read_excel</code></a>:</p>

<pre><code>df = pd.read_excel('test.xls', 
                   sheet_name='Sheet1', 
                   parse_cols=0, 
                   skiprows=list(range(205,1000)))
print (df)
</code></pre>

<p>Last use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.tolist.html" rel="nofollow"><code>tolist</code></a> for convert first column to <code>list</code>:</p>

<pre><code>print({"1": df.iloc[:,0].tolist()})
</code></pre>

<hr>

<p>The simpliest solution is parse only first column and then use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.iloc.html" rel="nofollow"><code>iloc</code></a>:</p>

<pre><code>df = pd.read_excel('test.xls', 
                   parse_cols=0)

print({"1": df.iloc[:206,0].astype(str).tolist()})
</code></pre>

python excel pandas xlsxwriter