import pandas as pd import re # EXAMPıe data for demonstration data = { 'Device_Type': ['AXO145', 'TRU151', 'ZOD231', 'YRT326', 'LWR245'], 'Stats_Access_Link': [ 'https://xcd32112.smart_meter.com', 'http://tXh67.dia_meter.com', 'http://yT5495.smart_meter.com', 'https://ret323_TRu.crown.com', 'https://luwr3243.celcius.com' ] } # Iet s Create DataFrame df = pd.DataFrame(data) # Function for extract raw URL def extract_url(access_link): # Regex pattern to match the URL part pattern = r'https?://([a-zA-Z0-9._]+)' match = re.search(pattern, access_link) if match: return match.group(1) return None # Apply the function to the Stats_Access_Link column df['Pure_URL'] = df['Stats_Access_Link'].apply(extract_url) # Display the result print(df[['Device_Type', 'Pure_URL']]) ##ANSWERS Device_Type Pure_URL 0 AXO145 xcd32112.smart_meter.com 1 TRU151 tXh67.dia_meter.com 2 ZOD231 yT5495.smart_meter.com 3 YRT326 ret323_TRu.crown.com 4 LWR245 luwr3243.celcius.com