In this video, we build on the previous machine learning with scikit-learn tutorial, and we're going to be pulling out the specific data point that we're interested in as using as a feature. sample code: http://pythonprogramming.net http://seaofbtc.com http://sentdex.com http://hkinsley.com https://twitter.com/sentdex Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Visibility: 16691
Duration: 11m 39s
Rating: 96
def Keystats(gather="Total Debt/Equity (mrq):"):
statspath = path+'\_KeyStats'
stock_list = [x[0] for x in os.walk(statspath)]
for each_dir in stock_list[1:]:
each_file = os.listdir(each_dir)
if(len(each_file)>0):
for lfile in each_file:
date_stamp = datetime.strptime(lfile,'%Y%m%d%H%M%S.html')
unix_time = time.mktime(date_stamp.timetuple())
filePath = each_dir+'\\'+lfile
fileContent = open(filePath,'r').read()
fileContentNew = fileContent.split(gather + '</td>')
if(len(fileContentNew)==1):
fileContentNew = fileContentNew[0].split(gather + '</th>')
if(len(fileContentNew)==1):
print(filePath)
continue
fileContentNew = fileContentNew[1]
if(fileContentNew.startswith('\n')):
fileContentNew = fileContentNew.split('\n<td class="yfnc_tabledata1">')[1].split('</td>')[0]
else:
fileContentNew = fileContentNew.split('<td class="yfnc_tabledata1">')[1].split('</td>')[0]