I have a CSV file, /home/user/file.csv
, such as:
V1
1.24
4.55
3
I am trying to read in only the numbers, without the prior knowledge that there is a header.
How do I read this and skip all String
elements keeping only ints/floats/long/etc?
The following attempt does not work because line
is not a number even if the row I am reading is a number:
f_in = open('/home/user/file.csv')
for line in f_in:
if !isinstance(line,basestring):
#Now we only have the rows that are numbers (but not really!)