Skip to content

Instantly share code, notes, and snippets.

View AlessandraSozzi's full-sized avatar

Alessandra Sozzi AlessandraSozzi

  • IMF
  • Washington, DC
View GitHub Profile
@AlessandraSozzi
AlessandraSozzi / index.html
Last active May 8, 2024 19:26
D3 drag and drop: manually reorder rows and columns of a matrix
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
.background {
fill: #fff;
}
rect {
stroke: #fff;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test API</title>
</head>
<body>
<script src="https://d3js.org/d3.v5.js"></script>
<script>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlessandraSozzi
AlessandraSozzi / README.md
Last active February 8, 2017 16:27
README structure

Project Title

Overview

At the top of the file there should be a short introduction and/ or overview that explains what the project is.

  • Explanation of the application and its purpose. Answer the questions:
    • What is the motivation behind the creation of the project? This should explain why the project exists.
    • Why is this project relevant to the user?
    • What purpose does it serve?
@AlessandraSozzi
AlessandraSozzi / index.html
Last active October 24, 2016 14:12
Measuring Sustainability Reporting using Web Scraping and Natural Language Processing
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>LDAvis</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(){}function a(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function o(){}function c(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,a=r.get(t);return arguments.length<2?a&&a.on:(a&&(a.on=null,e=e.slice(0,i=e.indexOf(a)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function l(){ca.event.stopPropagation(),ca.event.preventDefault()}function f(){for(var n,t=ca.event;n=t.sourceEvent;)t=n;return t}function s(n,t){function e(){n.on(t,null)}n.on(t,function(){l(),e()},!0),setTimeout(e,0)}function h(n){for(var t=new o,e=0,r=arguments.length;++e<r;)t[arguments[e]]=c(t);return t.of=function(e,r){return
@AlessandraSozzi
AlessandraSozzi / index.html
Last active August 30, 2016 03:15
Drag Behavior: drag bars in a bar chart
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
padding: 3px;
We can make this file beautiful and searchable if this error is corrected: It looks like row 16 should actually have 12 columns, instead of 4. in line 15.
Liability,Instrument,Asset,Y2006,Y2007,Y2008,Y2009,Y2010,Y2011,Y2012,Y2013,Y2014 MFI,Currency,PC,0.58,0.63,0.53,0.54,0.57,0.57,0.49,0.55,0.55 MFI,Currency,RoW,1.35,1.4,1.37,1.25,1.3,1.31,1.38,1.43,1.51 MFI,Currency,unknown,47.03,47.99,50.44,56.88,58.8,62,65.33,67.45,71.01 CG,Currency,PC,0.06,0.07,0.06,0.06,0.06,0.06,0.05,0.06,0.06 CG,Currency,RoW,0.15,0.16,0.15,0.14,0.14,0.15,0.15,0.16,0.17 CG,Currency,unknown,3.58,3.63,3.74,3.8,3.87,3.9,4.06,4.08,4.26 RoW,Currency,PNFC,0.54,0.59,0.56,0.48,0.5,0.5,0.51,0.48,0.56 RoW,Currency,MFI,0.16,0.19,0.38,0.31,0.15,0.12,0.12,0.15,0.19 unknown,Currency,PNFC,3.28,3.49,3.76,4.09,4.26,4.48,4.72,4.94,5.22 unknown,Currency,MFI,9.82,8.38,7.63,12.41,10.12,10.64,11.18,10.72,11.19 unknown,Currency,OFI,0.08,0.08,0.08,0.08,0.08,0.08,0.08,0.08,0.08 unknown,Currency,HH+NPISH,37.43,39.66,42.71,44.09,48.21,50.69,53.41,55.78,58.78 MFI,Deposits,PC,6,3.9,2.64,2.6,2.44,3.51,2.35,2.91,2.78 MFI,Deposits,PNFC,247.44,269.97,263.27,278.38,299.34,293.32,312.84,331.32,357.69 MFI,Deposits,MFI,1282.
@AlessandraSozzi
AlessandraSozzi / index.html
Last active August 30, 2016 03:13
Relationships among teams
<!DOCTYPE html>
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Noto+Sans:400,700' rel='stylesheet' type='text/css'>
<head>
<style>
.background {
fill: #fff;
}
@AlessandraSozzi
AlessandraSozzi / extract_list.py
Last active July 6, 2016 10:09
Script to scrape data from i-know-uk.com
from selenium import webdriver
from bs4 import BeautifulSoup
import time
import pandas as pd
def load_website(u):
driver_path = '/Users/Alessandra/Documents/WebDriver/chromedriver'
d = webdriver.Chrome(driver_path)
d.get(u)