Problem:
-
The
date_listis an empty list. -
Should not be empty because list length should equal list length of
octandfiling_type_list.
What I have done:
-
searched for typos.
-
tried different companies (example is of REXAHN PHARMACEUTICALS, INC).
-
used different words for the Xpath argument.
Code:
filing_dates_pg = requests.get('http://csuite.xbrl.us/php/dispatch.php?Task=xbrlValues&Element=NetCashProvidedByUsedInOperatingActivitiesContinuingOperations&CIK=0001228627&Ultimus=true&DimReqd=false&API_Key=4706bc13-b230-4f2b-af55-dc2d94632901') # The URL easiest to read in FIREFOX Browser. Datestree = html.fromstring(filing_dates_pg.text) date_list = Datestree.xpath('//periodStart/text()') filing_type_list = Datestree.xpath('//period/text()') ocf = Datestree.xpath('//amount/text()') print ocf # Works, list matches data in URL page print filing_type_list # Works print type(date_list) print date_list # Does NOT work Output
['-2977634', '-4566843', '-5146845', '-6986598', '-53917328', '-2425835', '-55897199', '-7490595', '-57546899', '-10651611', '-58620377', '-15530306', '-60171904', '-1916510', '-62675625', '-3896381', '-64356343', '-5546081', '-66605233', '-6619559', '-69181840', '-1551527', '-4055248', '-5735966', '-7984856', '-11041211', '-2576607', '-4038817', '-5527773', '-8441718', '-8129391', '-12944191'] ['1H', '3QCUM', 'Y', 'Y', '2001-03-19 - 2012-04-01', '1Q', '2001-03-19 - 2012-07-01', '1H', '2001-03-19 - 2012-10-01', '3QCUM', '2001-03-19 - 2013-01-01', 'Y', '2001-03-19 - 2013-04-01', '1Q', '2001-03-19 - 2013-07-01', '1H', '2001-03-19 - 2013-10-01', '3QCUM', '2001-03-19 - 2014-01-01', 'Y', '2001-03-19 - 2014-04-01', '1Q', '1H', '3QCUM', 'Y', 'Y', '1Q', '1Q', '1H', '1H', '3QCUM', '3QCUM'] <type 'list'> [] ValueError: Length mismatch: Expected axis has 0 elements, new values have 1 elements
No comments:
Post a Comment