how do i import from a unicode (utf-8) csv file into a numpy array

前端 未结 1 2048
走了就别回头了
走了就别回头了 2021-01-15 09:45

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,         


        
1条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-15 10:36

    This can be done easily with np.loadtxt:

    import numpy as np
    arr=np.loadtxt('all_user_token_counts.csv',delimiter=',',
                      dtype = '|U10,

    0 讨论(0)
提交回复
热议问题