>>> import petl as etl>>> table = etl.fromcsv("test.csv")>>> table+------------+------------------------------------+-----+-------+-------+| 11/02/17 | this is a string | 1 | 6 | asd |+============+====================================+=====+=======+=======+| '12/02/17' | 'oo another string' | '2' | '7' | 'qwe' |+------------+------------------------------------+-----+-------+-------+| '24/03/17' | 'one more time lets have a string' | '3' | '5.5' | 'zxc' |+------------+------------------------------------+-----+-------+-------+>>> fieldnames = ['1','2','3','4','5']
>>> sourcerows = []>>> with open('test.csv') as csvfile:... reader = csv.DictReader(csvfile, fieldnames=fieldnames)... for row in reader:... sourcerows.append(row)
>>> table = etl.json.fromdicts(sourcerows)>>> table+------------+------------------------------------+-----+-------+-------+| 1 | 2 | 3 | 4 | 5 |+============+====================================+=====+=======+=======+| '11/02/17' | 'this is a string' | '1' | '6' | 'asd' |+------------+------------------------------------+-----+-------+-------+| '12/02/17' | 'oo another string' | '2' | '7' | 'qwe' |+------------+------------------------------------+-----+-------+-------+| '24/03/17' | 'one more time lets have a string' | '3' | '5.5' | 'zxc' |+------------+------------------------------------+-----+-------+-------+
Wasn't too hard to just add the functionality myself
--
You received this message because you are subscribed to the Google Groups "python-etl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-etl+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.