greedo / python-xbrl

xbrl parser written in Python :bulb:
https://pypi.python.org/pypi/python-xbrl
Apache License 2.0
216 stars 76 forks source link

Serialized values all 0 #22

Open nhippenmeyer opened 8 years ago

nhippenmeyer commented 8 years ago

I've run through the setup and tried parsing this google 10-K form:

http://www.sec.gov/Archives/edgar/data/1288776/000128877614000020/goog-20131231.xml

However when I serialized the data, all values are 0, as seen below. Any idea what's happening here?

MarshalResult(data={u'liabilities': 0.0, u'net_cash_flows_financing_continuing': 0.0, u'revenue': 0.0, u'income_tax_expense_benefit': 0.0, u'income_from_equity_investments': 0.0, u'preferred_stock_dividends': 0.0, u'redeemable_noncontrolling_interest': 0.0, u'extraordary_items_gain_loss': 0.0, u'temporary_equity': 0.0, u'costs_and_expenses': 0.0, u'non_current_assets': 0.0, u'net_cash_flows_discontinued': 0.0, u'net_cash_flows_investing_discontinued': 0.0, u'liabilities_and_equity': 0.0, u'other_operating_income': 0.0, u'operating_income_loss': 0.0, u'income_before_equity_investments': 0.0, u'net_income_parent': 0.0, u'equity': 0.0, u'income_loss': 0.0, u'cost_of_revenue': 0.0, u'operating_expenses': 0.0, u'noncurrent_liabilities': 0.0, u'current_liabilities': 0.0, u'net_cash_flows_investing': 0.0, u'stockholders_equity': 0.0, u'net_income_loss': 0.0, u'net_cash_flows_investing_continuing': 0.0, u'nonoperating_income_loss': 0.0, u'net_cash_flows_financing': 0.0, u'net_income_shareholders': 0.0, u'comprehensive_income': 0.0, u'equity_attributable_interest': 0.0, u'commitments_and_contingencies': 0.0, u'comprehensive_income_parent': 0.0, u'net_cash_flows_operating_discontinued': 0.0, u'comprehensive_income_interest': 0.0, u'other_comprehensive_income': 0.0, u'equity_attributable_parent': 0.0, u'assets': 0.0, u'gross_profit': 0.0, u'net_cash_flows_operating_continuing': 0.0, u'current_assets': 0.0, u'interest_and_debt_expense': 0.0, u'net_income_loss_noncontrolling': 0.0, u'net_cash_flows_operating': 0.0}, errors={})
pythonliuj commented 8 years ago

results all zero for test example https://github.com/greedo/python-xbrl/tree/master/tests/goog-20140630.xml

greedo commented 8 years ago

@nhippenmeyer I am having problems reproducing this issue, could you post the code you are using. Thanks!

pythonliuj commented 8 years ago

(py1) C:\pyxbrl\python-xbrl-master\xbrl>ipython gaap.py {'liabilities': 0.0, 'net_cash_flows_financing_continuing': 0.0, 'revenue': 0.0, 'income_tax_expense_benefit': 0.0, 'common_shares_authorized': 0.0, 'income_fro m_equity_investments': 0.0, 'preferred_stock_dividends': 0.0, 'redeemable_noncon trolling_interest': 0.0, 'extraordary_items_gain_loss': 0.0, 'temporary_equity': 0.0, 'costs_and_expenses': 0.0, 'non_current_assets': 0.0, 'net_cash_flows_disc ontinued': 0.0, 'net_cash_flows_investing_discontinued': 0.0, 'liabilities_and_e quity': 0.0, 'other_operating_income': 0.0, 'operating_income_loss': 0.0, 'incom e_before_equity_investments': 0.0, 'net_income_parent': 0.0, 'equity': 0.0, 'inc ome_loss': 0.0, 'cost_of_revenue': 0.0, 'operating_expenses': 0.0, 'noncurrent_l iabilities': 0.0, 'current_liabilities': 0.0, 'net_cash_flows_investing': 0.0, ' stockholders_equity': 0.0, 'net_income_loss': 0.0, 'net_cash_flows_investing_con tinuing': 0.0, 'nonoperating_income_loss': 0.0, 'common_shares_outstanding': 0.0 , 'net_cash_flows_financing': 0.0, 'net_income_shareholders': 0.0, 'comprehensiv e_income': 0.0, 'equity_attributable_interest': 0.0, 'commitments_and_contingenc ies': 0.0, 'comprehensive_income_parent': 0.0, 'net_cash_flows_operating_discont inued': 0.0, 'comprehensive_income_interest': 0.0, 'other_comprehensive_income': 0.0, 'equity_attributable_parent': 0.0, 'assets': 0.0, 'common_shares_issued': 0.0, 'gross_profit': 0.0, 'net_cash_flows_operating_continuing': 0.0, 'current_a ssets': 0.0, 'interest_and_debt_expense': 0.0, 'net_income_loss_noncontrolling': 0.0, 'net_cash_flows_operating': 0.0}

greedo commented 8 years ago

@nhippenmeyer @pythonliuj again could you post the exact code you are using when parsing. Thanks!

arosen32 commented 8 years ago
xbrl_parser = XBRLParser()
xbrl = xbrl_parser.parse('aapl-20150627.xml')
gaap_obj = xbrl_parser.parseGAAP(xbrl, doc_date='20150627', doc_type='10-Q', context='current')
result = serializer.dump(gaap_obj)

Gives me a dictionary with all 0s

The file is at: http://www.sec.gov/Archives/edgar/data/320193/000119312515259935/aapl-20150627.xml

greedo commented 8 years ago
from xbrl import XBRLParser, GAAP, GAAPSerializer

xbrl_parser = XBRLParser()
xbrl = xbrl_parser.parse('aapl-20150627.xml')
gaap_obj = xbrl_parser.parseGAAP(xbrl, doc_date='20150627', doc_type='10-Q', context='current')
serializer = GAAPSerializer()
result = serializer.dump(gaap_obj)

print result

This is the code I am using @NoMoSnacks and I am getting data

gdsaxton commented 6 years ago

@greedo I just ran your code above (omitting the _doctype variable, which caused an error) and am getting mostly zeros as well. Perhaps the GAAP parser needs updating?

akudan commented 3 years ago

Any progress on this issue? Also running into this problem.

victoriaplummer commented 2 years ago

Actually - I think my doc is not an XML file - I'm v new to this.

I'm also running into this problem with a 10-Q file. Is doc_type no longer needed?

Code

        print('Parsing file {index} of {length}'.format(index=files.index(file)+1, length=len(files)))
        xbrl = xbrl_parser.parse(xml_filename)
        gaap_obj = xbrl_parser.parseGAAP(xbrl, doc_date=doc_date)
        serializer = GAAPSerializer()
        result = serializer.dump(gaap_obj)
        print(result)

Result

{'non_current_assets': 0.0, 'preferred_stock_dividends': 0.0, 'net_cash_flows_investing_continuing': 0.0, 'liabilities': 0.0, 'net_income_loss_noncontrolling': 0.0, 'net_cash_flows_investing_discontinued': 0.0, 'stockholders_equity': 0.0, 'extraordary_items_gain_loss': 0.0, 'common_shares_outstanding': 0.0, 'operating_expenses': 0.0, 'current_liabilities': 0.0, 'costs_and_expenses': 0.0, 'net_income_parent': 0.0, 'operating_income_loss': 0.0, 'net_cash_flows_operating_continuing': 0.0, 'net_cash_flows_operating': 0.0, 'comprehensive_income': 0.0, 'net_cash_flows_financing_continuing': 0.0, 'noncurrent_liabilities': 0.0, 'interest_and_debt_expense': 0.0, 'net_cash_flows_operating_discontinued': 0.0, 'cost_of_revenue': 0.0, 'net_cash_flows_discontinued': 0.0, 'equity': 0.0, 'equity_attributable_interest': 0.0, 'net_income_loss': 0.0, 'income_tax_expense_benefit': 0.0, 'current_assets': 0.0, 'liabilities_and_equity': 0.0, 'common_shares_authorized': 0.0, 'net_income_shareholders': 0.0, 'equity_attributable_parent': 0.0, 'comprehensive_income_interest': 0.0, 'gross_profit': 0.0, 'other_operating_income': 0.0, 'income_loss': 0.0, 'temporary_equity': 0.0, 'nonoperating_income_loss': 0.0, 'net_cash_flows_investing': 0.0, 'other_comprehensive_income': 0.0, 'assets': 0.0, 'commitments_and_contingencies': 0.0, 'redeemable_noncontrolling_interest': 0.0, 'net_cash_flows_financing': 0.0, 'income_from_equity_investments': 0.0, 'revenue': 0.0, 'income_before_equity_investments': 0.0, 'common_shares_issued': 0.0, 'comprehensive_income_parent': 0.0}