This visualization will be the first one that I will try to replicate using Python, Pandas, and Matplotlib/Seaborn.

The data required from MoH Github are from the following
Updated daily new cases for the entire country https://github.com/MoH-Malaysia/covid19-public/blob/main/epidemic/cases_malaysia.csv
Updated daily new cases for each state https://github.com/MoH-Malaysia/covid19-public/blob/main/epidemic/cases_state.csv
Static data of population for each states https://github.com/MoH-Malaysia/covid19-public/blob/main/static/population.csv
First We need to import the python packages that are required to run the script. And then we also need to load the CSV from MoH Github, into the respective data frame.




To calculate the sum of 2 weeks of new cases for the whole country over 10K population, rounding it to the single decimal point.

On the Covicnow website, they also presented data of Selangor, KL, and Putrajaya into one new group called “Klang Valley”, so I also created the new entry in preparation for the bar chart.

Now we just go through the entire state list (from the population data frame) to calculate the 2 weeks of new cases over each respective state.

Since I store the calculated data in a dictionary (maybe I should consider a list), I need to sort the list by the value of new cases, since it is presented that way on the Covicnow website.

Now we plot the horizontal bar chart using the data from the dictionary. Before that, I added the country data in the first of the data so that it got presented the same way.


The python code in Jupyter notebook can be downloaded from the following
https://github.com/sckhoo/Covicnow_pandas/blob/main/001_cases_per_10k.ipynb
Feel free to comment and critics, feedback is welcome. I am here to learn. As this website said “learning in public”
Thank you for reading.
