How to Use Sankey Chart to Report Business Earnings via Python Plotly? TSMC case study

Informula
IMU Framework Design
6 min readApr 23, 2024

--

Previously on How to Use Sankey Chart to report business earnings via Python Plotly? Part 1, 2, we used AMD’s quarterly income statement to show you how to build a Sankey Chart and how to report these components dynamically by sourcing the data from yahoo finance instead of static numbers. In this article, we are going to present how to parse earnings data from TSMC’s pdf reports import it into SQLite and visualize it via Sankey Chart.

Step 0: Install / Import required packages & mount your google drive & Define reporting date

!pip install tabula-py
!pip install sqlite3
import sqlite3
import pandas as pd

from google.colab import drive
drive.mount('/content/drive')

As_Of = '2024-04-18'
Company = 'TSMC'
Ticker = 'TSM'
FY = 'FY24'
FQ = 'Q1'

Step 1: As it does not allow us to source info directly through URL, we have to save the pdf files into Google Drive so that we can read it through via tabula.

import tabula

with…

--

--