加载大数据文件使用NumPy的loadtxt()方法

这是运行的结果:

使用loadtxt这个函数

import numpy
data = numpy.loadtxt(r'D:CSV\CsvDemo.csv',dtype='str',delimiter=',',skiprows=0)
print(type(data))
print(data)

这个函数的参数的意思:

https://www.jianshu.com/p/ef37f739b531

CsvDemo.csv文件的内容如下:

head1,head2,head3,head4,head5,head6,head7,head8,head9,head10
1,1,1,1,1,1,1,1,1,1
2,2,2,2,2,2,2,2,2,2
3,3,3,3,3,3,3,3,3,3
4,4,4,4,4,4,4,4,4,4
5,5,5,5,5,5,5,5,5,5
6,6,6,6,6,6,6,6,6,6
7,7,7,7,7,7,7,7,7,7
8,8,8,8,8,8,8,8,8,8
9,9,9,9,9,9,9,9,9,9
10,10,10,10,10,10,10,10,10,10
11,11,11,11,11,11,11,11,11,11
12,12,12,12,12,12,12,12,12,12
13,13,13,13,13,13,13,13,13,13
14,14,14,14,14,14,14,14,14,14
15,15,15,15,15,15,15,15,15,15
16,16,16,16,16,16,16,16,16,16
17,17,17,17,17,17,17,17,17,17
18,18,18,18,18,18,18,18,18,18
 

发布了44 篇原创文章 · 获赞 7 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_38060122/article/details/83064937