Input csv file:
a,b,c,d,e
1,2,3,4,2
3,4,5,6,3
3,4,5
1,2
Code:
import numpy as np
data = np.genfromtxt("sa.csv", dtype=None, delimiter=',', names=True)
print data['a'],data['b'],data['e']
I ll get an error
Traceback (most recent call last):
File "cs.py", line 3, in <module>
data = np.genfromtxt("sa.csv", dtype=None, delimiter=',', names=True)
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 1593, in genfromtxt
raise ValueError(errmsg)
ValueError: Some errors were detected !
Line #4 (got 3 columns instead of 5)
Line #5 (got 2 columns instead of 5)
How to deal with this and perform correlation based on the selected columns using statsmodels in python??