Skip to content

Instantly share code, notes, and snippets.

View AlejandroRomeroG's full-sized avatar
🏠
Working from home

Alejandro Romero González AlejandroRomeroG

🏠
Working from home
View GitHub Profile
@Gabriel-Chen
Gabriel-Chen / csv-remove-accent.py
Created June 24, 2018 06:06
Remove All Accent on Letters in a CSV File
# This gist is initially used for analysing data in Spanish
import unidecode
import csv
def remove_accent (feed):
csv_f = open(feed, encoding='latin-1', mode='r')
csv_str = csv_f.read()
csv_str_removed_accent = unidecode.unidecode(csv_str)
csv_f.close()
@JamesPHoughton
JamesPHoughton / rotate_label.md
Last active August 29, 2024 15:36
How to create rotary labels in networkx circular layout
g = nx.complete_graph([
    "playground equipment", "evanescent champagne", "curved spacetime", 
    "magic flute", "market returns", "spotty memory",
    "languid feeling", "include numpy as np", "acidic chemical", 
    "downton abbey", "tumble weeds", "precede the cause"])
node_locs = nx.circular_layout(g)
theta = {k: np.arctan2(v[1], v[0]) * 180/np.pi for k, v in node_locs.items() }
@alexeyknorre
alexeyknorre / stargazer_fix.r
Created May 31, 2022 04:50
Quick fix for stargazer <= 5.2.3 is.na() issue with long model names in R >= 4.2
## Quick fix for stargazer <= 5.2.3 is.na() issue with long model names in R >= 4.2
# Unload stargazer if loaded
detach("package:stargazer",unload=T)
# Delete it
remove.packages("stargazer")
# Download the source
download.file("https://cran.r-project.org/src/contrib/stargazer_5.2.3.tar.gz", destfile = "stargazer_5.2.3.tar.gz")
# Unpack
untar("stargazer_5.2.3.tar.gz")
# Read the sourcefile with .inside.bracket fun