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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.links line { | |
stroke: #999; | |
stroke-opacity: 0.6; | |
} | |
.nodes circle { |
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 os | |
from datetime import date | |
import zipfile | |
import sqlite3 | |
from sqlite3 import Error | |
import pandas as pd | |
def download_file(url: str, | |
workspace, # url of the file to download |
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
__author__ = """Peter Davidson FIA""" | |
__email__ = '[email protected]' | |
__version__ = '0.1' | |
__license__ = 'If you find this helpful, please say thank you' | |
import pandas as pd, numpy as np | |
def shear_array(df): | |
# This function just shears an array | |
# E.g. x = np.arange(9).reshape(3,3) | |
# shear_array(x) |
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
{"eur": {"0": {"1": -0.00157, "2": -0.00129, "3": -0.00038, "4": 0.00096, "5": 0.00232, "6": 0.00381, "7": 0.00526, "8": 0.00667, "9": 0.00801, "10": 0.00921, "11": 0.01026, "12": 0.0112, "13": 0.01208, "14": 0.01284, "15": 0.01344, "16": 0.01388, "17": 0.01422, "18": 0.01454, "19": 0.01488, "20": 0.01527, "21": 0.01574, "22": 0.01627, "23": 0.01683, "24": 0.01741, "25": 0.018, "26": 0.01859, "27": 0.01918, "28": 0.01976, "29": 0.02033, "30": 0.02088, "31": 0.02141, "32": 0.02193, "33": 0.02243, "34": 0.02292, "35": 0.02338, "36": 0.02383, "37": 0.02426, "38": 0.02468, "39": 0.02508, "40": 0.02547, "41": 0.02584, "42": 0.02619, "43": 0.02654, "44": 0.02687, "45": 0.02719, "46": 0.02749, "47": 0.02779, "48": 0.02807, "49": 0.02834, "50": 0.02861, "51": 0.02886, "52": 0.02911, "53": 0.02934, "54": 0.02957, "55": 0.02979, "56": 0.03001, "57": 0.03021, "58": 0.03041, "59": 0.03061, "60": 0.03079, "61": 0.03097, "62": 0.03115, "63": 0.03132, "64": 0.03148, "65": 0.03164, "66": 0.0318, "67": 0.03195, "68": 0.0321, |
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
def unpickle_to_excel(filenames, params): | |
import os | |
import pandas as pd | |
filename_pkl= os.path.splitext(filenames[0])[0] + '.pkl' | |
filename_xl=os.path.splitext(filenames[0])[0] + '.xlsx' | |
df = pd.read_pickle(filename_pkl) | |
df.reset_index().to_excel(filename_xl, index=False) | |
if __name__ == '__main__': | |
from context_menu import menus |
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 matplotlib, matplotlib.pyplot as plt, matplotlib.ticker as tick | |
import seaborn as sns | |
def get_waterfall_colours(df, stocks=None): | |
"""Returns color palette for drawing waterfall bars""" | |
default_colours = sns.color_palette("tab10") | |
index_rgb = [3, 2, 0,5] # Red, green, blue, brown | |
palette_subset = [default_colours[i] for i in index_rgb] | |
colour_palette = [] | |
for index, value in df.items(): |