Python is a powerful tool for accounting research and data analytics.
On this webpage, I share some python code snippets that I use often (and I forget). The snippets are mainly relevant to the following topics:
- Data wrangling;
- Visualization;
- Regular expression;
- Textual analysis;
- Web-scraping.
All code files are stored here. Check anything you’re interested in:
- Python functions.
- zip(): useful when turning (a1,a2,..), (b1,b2..),… into ((a1,b1), (a2, b2),..).
- map(): useful when executing a function for multiple iterable objects.
- Pandas.
-
FinanceDataReader: to download historical stock return data of US firms, etc.
- SQL in Python (sqlite3).
-
Regular expression (regex) - coming soon.
-
geopandas - coming soon.
- Webscraping.
- pandas.read_html().
- requests (coming soon).
- beautifulsoup (coming soon).
- selenium (coming soon).
- Visualization.