Reading multiple CSV files with headers in python with numpy?
<p>Currently I am using this code to read one complete csv file to my code:</p>

<pre><code>data = np.loadtxt('csv_Complete.csv', delimiter=',', skiprows=1)
</code></pre>

<p>However, Now I have multiple csv files that are in this format.</p>

<p>Log1.csv</p>

<pre><code>x1,x2,x3,x4....
1.5,3,5,7,8
2,5,1.2,5,2
1,3,3,5.5,6
</code></pre>

<p>log2.csv</p>

<pre><code> x1,x2,x3,x4....
 1,3.3,5,7,8
 2,5.1,1,5.5,2
 1,3,3,5,6
</code></pre>

<p>This is the method I am thinking of doing but it is not working. Getting a 
ValueError: could not convert string to float: </p>

<pre><code>log1 = np.loadtxt('log1.csv', delimiter=',', skiprows=1)
log2 = np.loadtxt('log2.csv', delimiter=',', skiprows=1)
log3 = np.loadtxt('log3.csv', delimiter=',', skiprows=1)
data = np.append([log1, log2, log3])
</code></pre>

<p>The error I am getting is:</p>

<pre><code> File "&lt;ipython-input-6-6155c8de61ad&gt;", line 1, in &lt;module&gt;
    runfile('C:/Users/Mmyname/.spyder2-py3/setdataexp.py', wdir='C:/Users/myname/.spyder2-py3')

  File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/myname/.spyder2-py3/setdataexp.py", line 5, in &lt;module&gt;
    log1 = np.loadtxt('log40a.csv', delimiter=',', skiprows=1)

  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 930, in loadtxt
    items = [conv(val) for (conv, val) in zip(converters, vals)]

  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 930, in &lt;listcomp&gt;
    items = [conv(val) for (conv, val) in zip(converters, vals)]

  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 659, in floatconv
    return float(x)

ValueError: could not convert string to float: 
</code></pre>

<p>It must be a <code>missing value</code> in file  <code>log40a.csv</code>.</p>

<p>I have the same error for file like:</p>

<pre><code>x1,x2,x3,x4....
1,3.3,5,7,8
2,5.1,,5.5,2
1,3,3,5,6
</code></pre>

<p>Base on <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html" rel="nofollow">documentation</a> if you have missing values you should use <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html#numpy.genfromtxt" rel="nofollow">genfromtxt function</a>.</p>

python