How Do I Import From A Unicode (utf-8) Csv File Into A Numpy Array
im not trying to do this smart or fast, just trying to do it at all. i have a file looks like this : $ cat all_user_token_counts.csv @5raphaels,in,15 @5raphaels,for,15 @5raphaels
Solution 1:
This can be done easily with np.loadtxt:
import numpy as np
arr=np.loadtxt('all_user_token_counts.csv',delimiter=',',
dtype = '|U10,<U10,int')
print(arr)
# [(u'@5raphaels', u'in', 15) (u'@5raphaels', u'for', 15)
# (u'@5raphaels', u'unless', 11) (u'@5raphaels', u'you', 11)]
Post a Comment for "How Do I Import From A Unicode (utf-8) Csv File Into A Numpy Array"