How to select all the rows with the same name and not only the first one?
<p>This is the xls file :    </p>

<pre><code>moto    5   2   45
moto    2   4   43
coche   8   54  12
coche   43  21  6
coche   22  14  18
</code></pre>

<p>And this is the code working with pyexcel library:</p>

<pre><code>import pyexcel as pe
data = pe.get_sheet(file_name="vehiculo.xls")
sheet = pe.Sheet(data, name_rows_by_column=0)
sheet.row.select(['coche'])
sheet.save_as("output.xls")
</code></pre>

<p>it returns only the fisrt row with name 'coche':</p>

<pre><code>coche   8   54  12
</code></pre>

<p>And I want all the rows with the name "coche".</p>

<p>Any idea? 
Thanks</p>

<p>Just iterate over the data:</p>

<pre><code>import pyexcel
from collections import defaultdict

results = defaultdict(list)
data = pe.get_sheet(file_name="vehiculo.xls")
for row in data.rows():
   results[row[0]] += row[1:]
</code></pre>

<p>You'll get the following:</p>

<pre><code>&gt;&gt;&gt; results['moto']
[5L, 2L, 45L, 2L, 4L, 43L]
</code></pre>

python python-2.7 pyexcel