Hi,
I'm trying to import into array the data contained in a html table.
I use BeautifulSoup as html parser

html = open('T0015.html','r')
bs = BeautifulSoup(html)
for tr in bs.findAll('tr')[1:]:
        table.append([td.p.string for td in tr.findAll('td')])

and I get this:

print table

[[u'1925', u'--', u'--', u'--', u'--', u'--', u'--', u'--', u'--', u'105.0']
[u'1926', u'--', u'--', u'--', u'--', u'--', u'--', u'--', u'--', u'136.0']
[u'1927', u'--', u'--', u'--', u'--', u'--', u'--', u'--', u'--', u'51.0']
[u'1928', u'--', u'--', u'--', u'nn', u'--', u'--', u'--', u'--', u'104.0']
,.......and so on]

How to put this list of list of strings in a numpy array, and set '--'
and 'nn' as NaN?

Thank you
Alessio

_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to