This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| import requests | |
| from typing import Tuple | |
| from bs4 import BeautifulSoup | |
| def get_uci_data_urls(url: str) -> Tuple[str]: | |
| r = requests.get(url) | |
| soup = BeautifulSoup(r.text, 'html.parser') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pandas as pd | |
| def correlate_sort(df: pd.DataFrame, method: str = 'pearson') -> pd.DataFrame: | |
| """ | |
| pd.DataFrame.corr() without redundancy and sorted by strength | |
| """ | |
| df = df.corr(method) | |
| df = df.mask(np.tril(np.ones(df.shape)).astype(np.bool)) | |
| df = df.stack().reset_index() |