Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Read CSV file into an array

Reply
Thread Tools

Read CSV file into an array

 
 
oyekomova
Guest
Posts: n/a
 
      01-10-2007
I would like to know how to read a CSV file with a header ( n columns
of float data) into an array without the header row.

 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      01-10-2007
oyekomova wrote:
> I would like to know how to read a CSV file with a header ( n columns
> of float data) into an array without the header row.


Did you read our responses from the last time you asked this question?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

 
Reply With Quote
 
 
 
 
Tobiah
Guest
Posts: n/a
 
      01-10-2007
oyekomova wrote:
> I would like to know how to read a CSV file with a header ( n columns
> of float data) into an array without the header row.
>

import csv

l = []
for line in csv.reader(open("my.csv").readlines()[1:]):
l.append(line)

Which really gets you a list of lists.

--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
csv read clean up and write out to csv Sacha Rook Python 2 11-02-2012 07:51 PM
read CSV file using csv library Li Chen Ruby 18 03-23-2010 12:44 AM
read and write csv file using csv module jliu66 Python 0 10-19-2007 03:12 PM
How to move data from a CSV file to a JTable, and from a JTable to a CSV file ? Tintin92 Java 1 02-14-2007 06:51 PM
How to read a .csv file into a 2D array? Todd Gardner Ruby 15 06-17-2004 10:24 PM



Advertisments