import json
def read_json(file_path):
with open(file_path, 'r') as file:
return json.load(file)
from urllib.parse import urlparse, parse_qs
def extract_query_params(url):
parsed_url = urlparse(url)
return parse_qs(parsed_url.query)
from urllib.parse import urlparse
def extract_domain(url):
return urlparse(url).netloc
def calculate_correlation(x, y):
mean_x = sum(x) / len(x)
mean_y = sum(y) / len(y)
numerator = sum((xi - mean_x) * (yi - mean_y) for xi, yi in zip(x, y))
denominator = (sum((xi - mean_x) ** 2 for xi in x) * sum((yi - mean_y) ** 2 for yi in y)) ** 0.5
return numerator / denominator if denominator else 0
import os
def list_files(directory):
return [file for file in os.listdir(directory) if os.path.isfile(os.path.join(directory, file))]
import os
def join_path(directory, filename):
return os.path.join(directory, filename)