Let’s see how to use Numpy genfromtxt function.
Using genfromtxt method
Numpy genfromtxt function let you load file content to your Python code. I’m doing genfromtxt like this:
import numpy as np import os os.chdir("C:/Users/Pythoneo/Documents/MyProjects") a = np.genfromtxt("data.csv", dtype='float', delimiter=',') print(a)
os.chdir gives the possibility to set source catalog. If not set genfromtxt function will use current catalog.
Genfromtxt Numpy function is having various parameters.