Skip to content

Instantly share code, notes, and snippets.

View SebastianoF's full-sized avatar

Sebastiano Ferraris SebastianoF

  • London
View GitHub Profile
@SebastianoF
SebastianoF / b001_04.py
Last active April 24, 2022 14:44
b001_04.py
# About 10 seconds
df_commuter = pd.read_csv("https://github.com/uber-web/kepler.gl-data/raw/master/ukcommute/data.csv")
df_commuter.head()
@SebastianoF
SebastianoF / b001_03.py
Last active April 24, 2022 14:45
b001_03.py
import contextily as cx
import geopandas as gpd
import matplotlib.pyplot as plt
import numpy as np
import osmnx
import pandas as pd
from keplergl import KeplerGl
from shapely.geometry import shape
@SebastianoF
SebastianoF / b001_02.txt
Last active April 25, 2022 08:22
b001_02.txt
# requirements.txt
geopandas==0.10.2
jupyter==1.0.0
keplergl==0.3.2
matplotlib==3.5.1
osmnx==1.1.2
pandas==1.4.2
seaborn==0.11.2
@SebastianoF
SebastianoF / b001_1.bash
Last active April 24, 2022 14:46
b001_1.bash
conda create -n geods python=3.9
conda activate geods
@SebastianoF
SebastianoF / counter.py
Created October 14, 2018 15:22
Count words in latex
import os
import subprocess
'''
Counts the words in the manually selected latex files in the list list_file
Commands to obtain the number of words in a .tex file:
'detex my_file.tex | wc -w'
where my_file.tex is one of the string in the list list_files
@SebastianoF
SebastianoF / permutation_insights.md
Last active August 16, 2018 16:55
permutations.py

For future reference after the discussion https://codereview.stackexchange.com/questions/201725/disjoint-cycles-of-a-permutation

How to go from Cauchy notation to cyclic notation of a permutation with python

After insights from @Accumulation (working but with extra loop and with no inverse) and @Martin R (not working but with cool insight and inverse), here is what I have got: (it seems to work, but is far from the pythonic-elegance suggested by Martin R).

def permutation_from_cauchy_to_disjoints_cycles(cauchy_perm):
@SebastianoF
SebastianoF / gist:5a43eec688674f1b885bf1dda77c17c1
Created September 4, 2017 09:15
Python, upload to pypi the latest code release
# setup.py must be there
# create the latest version
python setup.py bdist_wheel
# upload to pypi
twine upload dist/<your_code_name>_<your_version>.whl -r pypi