Skip to content

Instantly share code, notes, and snippets.

View ludovikcoba's full-sized avatar
🎯

Ludovik Coba ludovikcoba

🎯
View GitHub Profile

Installation of pyenv and virtualwrapper on Ubunto/Debian

Although Ubunto/Debian machines come already set up with Python 2.7.12, we might need different versions of python for experimentation. To do that we will use pyenv and virtualwrapper.

pyenv

pyenv is a software that allows to switch between multiple versions of python. It is advantageous if you want to have a per-project version of Python, allows the creation and management of virtual-environments.

Installing dependencies

To install the dependencies for pyenv run the following code:

import numpy as np
import pandas as pd
import scipy.stats
from math import sqrt
def cramers_v(x, y):
confusion_matrix = pd.crosstab(x, y)
chi2 = scipy.stats.chi2_contingency(confusion_matrix)[0]
n = confusion_matrix.sum().sum()
@ludovikcoba
ludovikcoba / gist:66af4ded474ea8673bafbede368c9e79
Created May 18, 2019 21:34
Yelp dataset conversion for python 3.7
# Fix of https://gist.github.com/paulgb/5265767
import json
import pandas as pd
from glob import glob
import sys
def convert(x):
ob = json.loads(x)