Skip to content

Instantly share code, notes, and snippets.

@rch
Created April 16, 2020 14:35
Show Gist options
  • Save rch/307be302cdab67aad70529abe667acf9 to your computer and use it in GitHub Desktop.
Save rch/307be302cdab67aad70529abe667acf9 to your computer and use it in GitHub Desktop.
import numpy as np
def basic_way(filename):
with open(filename, 'r') as f:
lst = [line.split(',') for line in f]
return np.array(lst)
def another_way(filename):
return np.genfromtxt(filename, delimiter=',')
name = 'your.csv'
a = basic_way(name)
b = another_way(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment