Jul-19-2019, 07:50 PM
Hello Everyone!
Would you help me solve the following problem i have:
I am trying to write a user defined function that would load, read date from a csv file, itereate through the column where row of values being examined are located, check those values against current value (price = live.get_live_price("AAPL"))and then take an action (in this case to print it out) if the comparison meet certain condition (row value < price or row == price). when i run the script i do not get any error message and yet there is no output at all.
Thank you
Would you help me solve the following problem i have:
I am trying to write a user defined function that would load, read date from a csv file, itereate through the column where row of values being examined are located, check those values against current value (price = live.get_live_price("AAPL"))and then take an action (in this case to print it out) if the comparison meet certain condition (row value < price or row == price). when i run the script i do not get any error message and yet there is no output at all.
Thank you
#import all necessary modules import csv from yahoo_fin import stock_info as live import pandas as pd from datetime import date import datetime def readfile(filepath): #get Apple's latest quote price price = live.get_live_price("AAPL") with open(r'C:\Users\...\Desktop\AAPLCSV', 'r') as file: reader = csv.reader(file) for index, row in reader: if row[3] < price: return price elif row[3] == price: return row[3] print(price, row[3])