Skip to content

Instantly share code, notes, and snippets.

View sakethramanujam's full-sized avatar
:shipit:
bravo alpha zulu india november golf alpha

Saketha Ramanjam sakethramanujam

:shipit:
bravo alpha zulu india november golf alpha
View GitHub Profile
@sakethramanujam
sakethramanujam / metadata-download.py
Last active March 11, 2021 18:48
Percy Metadata Downloader in Python
import math
import os
import json
import pandas as pd
import requests
from tqdm import tqdm
import os
import json
import tempfile
from datetime import datetime as dt
@sakethramanujam
sakethramanujam / Installing libgfortran3 for ubuntu20.04.md
Last active August 18, 2024 20:26
Installing libgfortran3 for ubuntu20.04.md

Installing libgfortran3 on ubuntu 20.04

Download the following debian packages either by navigating to the url or by doing a wget

Post Download install the packages by using a software installer or using the

$ sudo dpkg -i 
import math
import pandas as pd
import numpy as np
from typing import List, Tuple, Union, Dict
from scipy.stats import skew, kurtosis
from .errors import StepSizeError, StepTypeError, SeriesError
class Statistics:
"""
Methods to calculate statistics all or one at a time
@sakethramanujam
sakethramanujam / caller.py
Last active July 24, 2020 16:55
A Dataclass example
series = [1,2,3,4,5]
stats = Statistics(series)
mean = stats.mean()
dev = stats.dev()

Keybase proof

I hereby claim:

@sakethramanujam
sakethramanujam / topwords.py
Created April 23, 2020 09:06
Get Top Words!
import argparse
import re
from typing import Dict
def args():
parser = argparse.ArgumentParser()
parser.add_argument(
'-f', '--file', help='Name of file to count words from')
parser.add_argument('-n', '--N', help='Number of top items', type=int)
@sakethramanujam
sakethramanujam / scrape-countries.py
Last active March 21, 2020 07:43
Scraping WHO list of countries using BeautifulSoup url : https://www.who.int/countries/en/
# !usr/bin/env python3
import requests
from bs4 import BeautifulSoup
if __name__ == '__main__':
url = 'https://www.who.int/countries/en/'
content = requests.get(url).content
soup = BeautifulSoup(content,'html5lib')
divs = soup.findAll('div', attrs={'class':'largebox'})
@sakethramanujam
sakethramanujam / fi.py
Created December 11, 2019 09:24
Saving Feature Importances
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
def charmap(label):
SUB = str.maketrans("0123456789", "₀₁₂₃₄₅₆₇₈₉")
mu = chr(956)
sigma = chr(963)
beta = chr(946)
cmap = {'mean_x': mu+'$_{\ x}$','mean_y':mu+'$_{\ y}$','mean_sum': mu+'$_{\ I}$','mean_mag': mu+'$_{\ mag}$','mean_dir':mu+'$_{\ dir}$',
'std_x':sigma+'$_{\ x}$','std_y':sigma+'$_{\ y}$','std_sum':sigma+'$_{\ I}$','std_mag':sigma+'$_{\ mag}$','std_dir':sigma+'$_{\ dir}$',
@sakethramanujam
sakethramanujam / Usage.md
Last active December 10, 2019 05:31
Saving Feature Importances

The above code can be used as follows

path_to_save_fi = 'your/path/'
save_importances(model,y_test.columns)
@sakethramanujam
sakethramanujam / pickle.py
Created December 9, 2019 10:32
Functions to save machine learning Models as .pickle files and importing them
import pickle
def save_pickle(model):
name=input('Name of the model: ')
with open(f'{name}.pickle','wb') as model:
pickle.dump(rf_model,model)
print('Model Saved.')
def load_pickle(filename):
file = open(filename,'rb')
model = pickle.load(file)