How to convert a string list from csv file to float?
<p>I am trying to read a csv file as a matrix like this:</p>

<pre><code>import csv
with open("data.csv", "r") as file:
    table = [line for line in csv.reader(file)]
    for line in table:
        print(line)
</code></pre>

<p>But, I need to convert the content of the lists to floats. i tried to convert to float using </p>

<pre><code>table = [int(x) for x in table]
</code></pre>

<p>however this comes up as an error </p>

<blockquote>
  <p>TypeError: int() argument must be a string or a number, not 'list'</p>
</blockquote>

<p>How can fix this?</p>