numpy读取CSV

1
2
3
4
5
6
7
8
9
10
####### 读取csv
import numpy as np

#按行读取,每个元素对应一行
data = np.genfromtxt("data.csv", delimiter=',',dtype=np.str_) #默认dtype=np.float64,无法显示字符串

print(data)
print(len(data))
print(type(data))
print(type(data[0][0]))

转载请注明来源 https://tianweiye.github.io