IDEAS home Printed from https://ideas.repec.org/a/now/fntacc/1400000062.html
   My bibliography  Save this article

Using Python for Text Analysis in Accounting Research

Author

Listed:
  • Anand, Vic
  • Bochkay, Khrystyna
  • Chychyla, Roman
  • Leone, Andrew

Abstract

The prominence of textual data in accounting research has increased dramatically. To assist researchers in understanding and using textual data, this monograph defines and describes common measures of textual data and then demonstrates the collection and processing of textual data using the Python programming language. The monograph is replete with sample code that replicates textual analysis tasks from recent research papers. In the first part of the monograph, we provide guidance on getting started in Python. We first describe Anaconda, a distribution of Python that provides the requisite libraries for textual analysis, and its installation. We then introduce the Jupyter notebook, a programming environment that improves research workflows and promotes replicable research. Next, we teach the basics of Python programming and demonstrate the basics of working with tabular data in the Pandas package. The second part of the monograph focuses on specific textual analysis methods and techniques commonly used in accounting research. We first introduce regular expressions, a sophisticated language for finding patterns in text. We then show how to use regular expressions to extract specific parts from text. Next, we introduce the idea of transforming text data (unstructured data) into numerical measures representing variables of interest (structured data). Specifically, we introduce dictionary-based methods of (1) measuring document sentiment, (2) computing text complexity, (3) identifying forward-looking sentences and risk disclosures, (4) collecting informative numbers in text, and (5) computing the similarity of different pieces of text. For each of these tasks, we cite relevant papers and provide code snippets to implement the relevant metrics from these papers. Finally, the third part of the monograph focuses on automating the collection of textual data. We introduce web scraping and provide code for downloading filings from EDGAR.

Suggested Citation

  • Anand, Vic & Bochkay, Khrystyna & Chychyla, Roman & Leone, Andrew, 2020. "Using Python for Text Analysis in Accounting Research," Foundations and Trends(R) in Accounting, now publishers, vol. 14(3-4), pages 128-359, December.
  • Handle: RePEc:now:fntacc:1400000062
    DOI: 10.1561/1400000062
    as

    Download full text from publisher

    File URL: http://dx.doi.org/10.1561/1400000062
    Download Restriction: no

    File URL: https://libkey.io/10.1561/1400000062?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Price, S. McKay & Doran, James S. & Peterson, David R. & Bliss, Barbara A., 2012. "Earnings conference calls and stock returns: The incremental informativeness of textual tone," Journal of Banking & Finance, Elsevier, vol. 36(4), pages 992-1011.
    2. Paul C. Tetlock & Maytal Saar‐Tsechansky & Sofus Macskassy, 2008. "More Than Words: Quantifying Language to Measure Firms' Fundamentals," Journal of Finance, American Finance Association, vol. 63(3), pages 1437-1467, June.
    3. Paul C. Tetlock, 2007. "Giving Content to Investor Sentiment: The Role of Media in the Stock Market," Journal of Finance, American Finance Association, vol. 62(3), pages 1139-1168, June.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Nerantzidis, Michail & Tampakoudis, Ioannis & She, Chaoyuan, 2024. "Social media in accounting research: A review and future research agenda," Journal of International Accounting, Auditing and Taxation, Elsevier, vol. 54(C).
    2. Saura, Jose Ramon & Ribeiro-Navarrete, Samuel & Palacios-Marqués, Daniel & Mardani, Abbas, 2023. "Impact of extreme weather in production economics: Extracting evidence from user-generated content," International Journal of Production Economics, Elsevier, vol. 260(C).

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Yan Luo & Linying Zhou, 2020. "Textual tone in corporate financial disclosures: a survey of the literature," International Journal of Disclosure and Governance, Palgrave Macmillan, vol. 17(2), pages 101-110, September.
    2. Eryka Probierz & Adam Galuszka & Katarzyna Klimczak & Karol Jedrasiak & Tomasz Wisniewski & Tomasz Dzida, 2021. "Financial Sentiment on Twitter's Community and it's Connection to Polish Stock Market Movements in Context of Behavior Modelling," European Research Studies Journal, European Research Studies Journal, vol. 0(4 - Part ), pages 56-65.
    3. Thomas Renault, 2020. "Sentiment analysis and machine learning in finance: a comparison of methods and models on one million messages," Digital Finance, Springer, vol. 2(1), pages 1-13, September.
    4. An, Suwei, 2023. "Essays on incentive contracts, M&As, and firm risk," Other publications TiSEM dd97d2f5-1c9d-47c5-ba62-f, Tilburg University, School of Economics and Management.
    5. D. G. DeBoskey & Yan Luo & Linying Zhou, 2019. "CEO power, board oversight, and earnings announcement tone," Review of Quantitative Finance and Accounting, Springer, vol. 52(2), pages 657-680, February.
    6. Renato Camodeca & Alex Almici & Umberto Sagliaschi, 2018. "Sustainability Disclosure in Integrated Reporting: Does It Matter to Investors? A Cheap Talk Approach," Sustainability, MDPI, vol. 10(12), pages 1-34, November.
    7. Miwa, Kotaro, 2023. "Divergent opinions on social media," International Review of Economics & Finance, Elsevier, vol. 86(C), pages 182-196.
    8. Wanli Li & Tiantian Yan & Yue Li & Ziqiao Yan, 2023. "Earnings management and CSR report tone: Evidence from China," Corporate Social Responsibility and Environmental Management, John Wiley & Sons, vol. 30(4), pages 1883-1902, July.
    9. Christina Bannier & Thomas Pauls & Andreas Walter, 2019. "Content analysis of business communication: introducing a German dictionary," Journal of Business Economics, Springer, vol. 89(1), pages 79-123, February.
    10. Kearney, Colm & Liu, Sha, 2014. "Textual sentiment in finance: A survey of methods and models," International Review of Financial Analysis, Elsevier, vol. 33(C), pages 171-185.
    11. Frankel, Richard & Jennings, Jared & Lee, Joshua, 2016. "Using unstructured and qualitative disclosures to explain accruals," Journal of Accounting and Economics, Elsevier, vol. 62(2), pages 209-227.
    12. Shuyu Zhang & Walter Aerts & Dunli Zhang & Zishan Chen, 2022. "Positive tone and initial coin offering," Accounting and Finance, Accounting and Finance Association of Australia and New Zealand, vol. 62(2), pages 2237-2266, June.
    13. Miwa, Kotaro, 2022. "The informational role of analysts’ textual statements," Research in International Business and Finance, Elsevier, vol. 59(C).
    14. Tim Loughran & Bill Mcdonald, 2016. "Textual Analysis in Accounting and Finance: A Survey," Journal of Accounting Research, Wiley Blackwell, vol. 54(4), pages 1187-1230, September.
    15. Ardia, David & Bluteau, Keven & Boudt, Kris, 2022. "Media abnormal tone, earnings announcements, and the stock market," Journal of Financial Markets, Elsevier, vol. 61(C).
    16. Richard Frankel & Jared Jennings & Joshua Lee, 2022. "Disclosure Sentiment: Machine Learning vs. Dictionary Methods," Management Science, INFORMS, vol. 68(7), pages 5514-5532, July.
    17. Yekini, Liafisu Sina & Wisniewski, Tomasz Piotr & Millo, Yuval, 2016. "Market reaction to the positiveness of annual report narratives," The British Accounting Review, Elsevier, vol. 48(4), pages 415-430.
    18. Arslan-Ayaydin, Özgür & Boudt, Kris & Thewissen, James, 2016. "Managers set the tone: Equity incentives and the tone of earnings press releases," Journal of Banking & Finance, Elsevier, vol. 72(S), pages 132-147.
    19. repec:ers:journl:v:xxiv:y:2021:i:4b:p:56-65 is not listed on IDEAS
    20. Jason V. Chen & Itay Kama & Reuven Lehavy, 2019. "A contextual analysis of the impact of managerial expectations on asymmetric cost behavior," Review of Accounting Studies, Springer, vol. 24(2), pages 665-693, June.
    21. Bassyouny, Hesham & Abdelfattah, Tarek & Tao, Lei, 2022. "Narrative disclosure tone: A review and areas for future research," Journal of International Accounting, Auditing and Taxation, Elsevier, vol. 49(C).

    More about this item

    Keywords

    Accounting;

    JEL classification:

    • M41 - Business Administration and Business Economics; Marketing; Accounting; Personnel Economics - - Accounting - - - Accounting

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:now:fntacc:1400000062. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Lucy Wiseman (email available below). General contact details of provider: http://www.nowpublishers.com/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.