I have some very simple data I created that I saved in a csv file to test :
1,1.8
2,4.5
3,9.6
4,16
5,25.3
And I want to import them in Python. In IDLE this works as expected using genfromtxt from the numpy package:
>>> my_data = genfromtxt('very_simple_data.csv', delimiter=',')
>>> my_data
array([[ 1. , 1.8],
[ 2. , 4.5],
[ 3. , 9.6],
[ 4. , 16. ],
[ 5. , 25.3]])
But the same code cut n pasted into a Jupyter notebook doesn't work:
In[23]: my_data = genfromtxt('very_simple_data.csv', delimiter=',')
In[24]: my_data
Out[24]: array([ 1. , nan, nan, nan, nan, 25.3])
So there are two problems here: first some values are not being stored as numbers and I do not have a 2 dimensional array.
A more basic implementation in Jupyter does work:
In[25]: with open('very_simple_data.csv', 'r') as f:
reader = csv.reader(f)
new_data = list(reader)
In[26]: new_data
Out[26]: [['1', '1.8'], ['2', '4.5'], ['3', '9.6'], ['4', '16'], ['5', '25.3']]
The only thing I can think of is the numpy package on my machine is v 1.14.0 and the one associated with Jupyter is a bit older: 1.11.3 (which I gather you are 'stuck' with when using Jupyter).
Any ideas on what is going on? Or is Jupyter not considered that stable?