In [1]:
import numpy as np
In [2]:
with open('data/src/sample.txt') as f:
print(f.read())
In [3]:
a = np.loadtxt('data/src/sample.txt')
In [4]:
print(type(a))
In [5]:
print(a)
In [6]:
print(a.dtype)
In [7]:
with open('data/src/sample.csv') as f:
print(f.read())
In [8]:
# print(np.loadtxt('data/src/sample.csv'))
# ValueError: could not convert string to float: '11,12,13,14'
In [9]:
print(np.loadtxt('data/src/sample.csv', delimiter=','))
In [10]:
a = np.loadtxt('data/src/sample.csv', delimiter=',', dtype='int64')
In [11]:
print(a)
In [12]:
print(a.dtype)
In [13]:
with open('data/src/sample_header_index.csv') as f:
print(f.read())
In [14]:
a = np.loadtxt('data/src/sample_header_index.csv', delimiter=',', dtype='int64',
skiprows=1, usecols=[1, 2, 3, 4])
In [15]:
print(a)