I've already read these 2 questions before asking this one (q1 and q2) but I haven't found any satisfying answer
I need to extract two columns from a 2D-array without using pandas or loadtxt, but with genfromtxt
For now, what I did is:
X = np.genfromtxt('File1.csv',
delimiter='\t',
skip_header=0, skip_footer=0,
names=True , usecols=("Time") )
Y = np.genfromtxt('File1.csv',
delimiter='\t',
skip_header=0, skip_footer=0,
names=True , usecols=("Profit") )
then, using matplotlib I plot Y vs X, result is perfect
Now, I was thinking that I should do it the "right" way and avoid reading twice the array. So I tried the unpack feature:
X, Y = np.genfromtxt('File1.csv',
delimiter='\t',
skip_header=0, skip_footer=0,
names=True , usecols=("Time", "Profit"), unpack=True )
I get the message: too many values to unpack
Now if I write the previous command with one vector for the output (say Z) without unpacking, the vector Z will contain a tuple that cannot be plotted directly.
Any solution to this simple-looking problem ?