Python

Plotly Express Python remove legend title

Plotly.py 4.5, Plotly Express no longer puts the = in trace names, because legends support titles (source). Prior to Plotly.py 4.5, I had used this ‘hover_data’ trick to remove the ‘=’ from the legend trace names. hover_data=[‘gain_loss’]).for_each_trace(lambda t: t.update(name=t.name.split(“=”)[0]) However now with Plotly.py 4.5, I want to remove the legend title. The new trick to […]

Plotly Express Python remove legend title Read More »

Scraping public health web page using Python, BeautifulSoup4, Requests and Pandas

During the 2020 COVID-19 pandemic in Canada I wanted to get COVID-19 confirmed cases counts data for the city of Montreal. The data I wanted was made freely available by the Quebec Government’s Health Montreal website in a tabular format that was updated regularly.  EDIT: Health Montreal stopped publishing data so the link no longer

Scraping public health web page using Python, BeautifulSoup4, Requests and Pandas Read More »

Choropleth map of Canada COVID-19 cases by health region using Leaflet and D3.js

During the early days of the 2020 COVID-19 pandemic in Canada, I wanted to get better understanding of the geographical distribution of COVID-19 cases across Canada. At the time, government or news agencies were only mapping case counts by province. However Canadian provinces are so big compared to population centers that it doesn’t accurately reflect

Choropleth map of Canada COVID-19 cases by health region using Leaflet and D3.js Read More »

Scroll to Top