I am currently learning Regex in Python and my expected Regex results are not showing (I'm running Python 3.6). Below is the code to get the String values I'm running my regex against:
import json
import os
import pandas as pd
import requests
import re
url = 'http://www.trumba.com/calendars/brisbane-city-council.json'
uh = requests.get(url)
json_data = json.loads(uh.text)
json_str = json.dumps(json_data)
panda_json = pd.read_json(json_str, typ = 'frame')
Now, I want to take a match of the html hyperlink in 'location'
With the Regex, I'm expecting to find matches such as below (anything between [<] and [>]):
<a href="http://maps.google.com/?q=33+Teevan+St%2c+Stafford+QLD+4053%2c+Australia" target="_blank">
so I'm using below Regex:
pattern = re.compile(r'/[<].*?[>]/')
and then try to store them into a dataframe
matches = re.findall(pattern, str(panda_json['location']))
x = []
for match in matches:
x.append(match)
x = pd.DataFrame(x)
But 'x' does not show anything? I'm sure I'm missing something obvious.