Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

yield value from csv file python

import csv
import numpy as np

def getData(filename1, filename2):
    with open(filename1, "rb") as csv1, open(filename2, "rb") as csv2:
        reader1 = csv.reader(csv1)
        reader2 = csv.reader(csv2)
        for row1, row2 in zip(reader1, reader2):
            yield (np.array(row1, dtype=np.float),
                   np.array(row2, dtype=np.float)) 
                # This will give arrays of floats, for other types change dtype

for tup in getData("file1", "file2"):
    print(tup)
Comment

PREVIOUS NEXT
Code Example
Python :: duplicate finder python modules 
Python :: treat NaN as a category 
Python :: Jhoom.In 
Python :: call for a last number in series python 
Python :: doc2text python example 
Python :: python: dunder init method 
Python :: matplotlib convert color string to int 
Python :: mudopy 
Python :: how to set time.sleep(2) on instapy 
Python :: addind scheduling of tasks to pyramid python app 
Python :: discord.py assign role 
Python :: Create a new list from a list when a certain condition is met 
Python :: qq plot using seaborn 
Python :: fibonacci series program in python 
Python :: JET token authentication in Django UTC 
Python :: EMAIL_BACKEND where to read 
Python :: parsing a file and adding a number at starting of every line sentence python 
Python :: list all subdirectories up to a level 
Python :: priting matrix using np truncating the output 
Python :: get node name dynamo revit 
Python :: effient way to find prime no inpython 
Python :: append to a list without intializing 
Python :: python clean filename 
Python :: close window tkiinter 
Python :: quadkey calculator 
Python :: perfect power function python 
Python :: changing speak rate pyttsx 
Python :: Code Example to Check the type of None object 
Python :: extract tables from image python 
Python :: meter replacement application 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =