Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import pandas as pd
import numpy as np
file_key = "1sIkC1vBalHB8SJsgpPazFGUSrMNUani6jLrOFS6IEFo"
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{file_key}/export?format=csv")
for [item,number] in df.to_numpy():
with open(item, 'w') as f:
f.write(f'{{"number":"{number}"}}')
import numpy as np
from scipy.optimize import curve_fit
import pandas as pd
import datetime
import matplotlib.pyplot as plt
url = "https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv"
df = pd.read_csv(url)
def line(x, a, b):
@malemi
malemi / word2vecRecommender.ipynb
Last active May 1, 2018 19:58
Word2vec Recommender
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@malemi
malemi / document_similarity_w2v_llr.py
Last active February 3, 2017 16:35
Tests on document similarity using word2vec and log likelihood ratio. I have used Italian because Italian language models are worse than English ones, and I want to test with something not-optimal.
#python3
import numpy as np
from itertools import combinations_with_replacement
from pyemd import emd
from scipy import spatial
import gensim as gs
synzero = np.load('data/it/wiki_iter.m.syn0.npy')
synoneneg = np.load('data/it/wiki_iter.m.syn1neg.npy')
table = np.load('data/it/wiki_iter.m.table.npy')
@malemi
malemi / stat.js
Created February 27, 2016 10:24
Addon for Google Spreadsheet / A bunch of statistical functions in a new menu "QM Stat"
// QM Stat 0.2
// Simple Data Mining Algorithms, (c) Mario Alemi 2010
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@malemi
malemi / appsscript_import_json.js
Last active February 27, 2016 10:22 — forked from paulgambill/import_json_appsscript.js
Addon for Google Spreadsheet / Import JSON from external RESTful http APIs
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();