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. 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. 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.
    3. 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.
    4. 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.
    5. 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.
    6. Miwa, Kotaro, 2021. "Language barriers in analyst reports," International Review of Economics & Finance, Elsevier, vol. 75(C), pages 223-236.
    7. 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.
    8. Auzepy, Alix & Bannier, Christina E. & Martin, Fabio, 2023. "Walk the talk: Shareholders' soft engagement at annual general meetings," CFS Working Paper Series 689, Center for Financial Studies (CFS).
    9. Maciej Wujec, 2021. "Analysis of the Financial Information Contained in the Texts of Current Reports: A Deep Learning Approach," JRFM, MDPI, vol. 14(12), pages 1-17, December.
    10. Ingrid E. Fisher & Margaret R. Garnsey & Mark E. Hughes, 2016. "Natural Language Processing in Accounting, Auditing and Finance: A Synthesis of the Literature with a Roadmap for Future Research," Intelligent Systems in Accounting, Finance and Management, John Wiley & Sons, Ltd., vol. 23(3), pages 157-214, July.
    11. 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.
    12. 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.
    13. 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.
    14. 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.
    15. Banerjee, Ameet Kumar & Dionisio, Andreia & Pradhan, H.K. & Mahapatra, Biplab, 2021. "Hunting the quicksilver: Using textual news and causality analysis to predict market volatility," International Review of Financial Analysis, Elsevier, vol. 77(C).
    16. 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.
    17. Miwa, Kotaro, 2022. "The informational role of analysts’ textual statements," Research in International Business and Finance, Elsevier, vol. 59(C).
    18. 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.
    19. Ardia, David & Bluteau, Keven & Boudt, Kris, 2022. "Media abnormal tone, earnings announcements, and the stock market," Journal of Financial Markets, Elsevier, vol. 61(C).
    20. Rahman, Sheehan, 2023. "Narrative tone and earnings persistence," Journal of International Accounting, Auditing and Taxation, Elsevier, vol. 52(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.