Examine the HTML Use Best HTML Viewer, HTML Beautifier, HTML Formatter and to Test / Preview HTML Output (codebeautify.org) beautifier to view html.
We can simply use Pandas.read_html() to read the tables inside a given html.
If you ever faced the problem UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in position 4204: illegal multibyte sequence
Simply add a parameter encoding="utf-8" to the open.1
But, what if we have a HTML body that has nested tables.
Background I’m developing a News Board in Powerapps. I utilize RSS Connector to retrieve Google News for the following effect. featured-image Temp Solution At first I used a trick to create the thumbnails by searching on Unsplash’s Api for news title related img then put it into HtmlText Control.
1 "<img src="&Char(34)&"https://source.unsplash.com/featured/?"&Last(FirstN(Split(ThisItem.title, " "), 2)).Result&Char(34)&" width="&Char(34)&Self.Width&Char(34)&" height="&Char(34)&Self.Height*0.8&Char(34)&">" The risk is Unsplash terminated the api and it did have happened. Don’t worry.
Question Bus Routes - LeetCode
Attempts Classic DFS At first, I came oup with a classic DFS solution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 from collections import defaultdict, deque class Solution: def numBusesToDestination(self, routes: List[List[int]], source: int, target: int) -> int: adj_map = defaultdict(list) visited_map = defaultdict(lambda: False) # travers the routes to build a Adj List for r in routes: for i in range(len(r)): # reach the end if i == len(r)-1: adj_map[r[i]].
Img Source: https://unsplash.com/photos/Wpnoqo2plFA Read a CSV with PyArrow In Pandas 1.4, released in January 2022, there is a new backend for CSV reading, relying on the Arrow library’s CSV parser. It’s still marked as experimental, and it doesn’t support all the features of the default parser—but it is faster.1
CSV parser Elapsed time CPU time (user+sys) Default C 13.2 seconds 13.2 seconds PyArrow 2.7 seconds 6.5 seconds 1 2 3 import pandas as pd pd.