Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4cf63e7

Browse files
stefanvmdboom
authored andcommitted
In csv2rec, ensure that each record passed to numpy's fromrecords has the same number of elements.
1 parent 257036e commit 4cf63e7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/matplotlib/mlab.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,8 @@ def get_converters(reader):
23212321
for i, row in enumerate(reader):
23222322
if not len(row): continue
23232323
if row[0].startswith(comments): continue
2324+
# Ensure that the row returned always has the same nr of elements
2325+
row.extend([''] * (len(converters) - len(row)))
23242326
rows.append([func(name, val) for func, name, val in zip(converters, names, row)])
23252327
rowmasks.append([ismissing(name, val) for name, val in zip(names, row)])
23262328
fh.close()

0 commit comments

Comments
 (0)