Skip to content

Instantly share code, notes, and snippets.

View lennymd's full-sized avatar

Lenny Martinez Dominguez lennymd

View GitHub Profile
let outcomes_health;
async function get_values() {
let data = await d3.csv('https://raw.githubusercontent.com/lennymd/test_evidence_map/main/public/data/column_values.csv');
const cols = data.columns;
let values = {};
cols.forEach(col => (values[col] = d3.map(data, d => d[col]).keys()));
outcomes_health = values['health_outcomes'];
}
get_values();
console.log(outcomes_health);
library(tidyverse)
# Read CSV file
df <- read_csv("https://raw.githubusercontent.com/lennymd/formulaOneAnalysis/main/data/race_results_statsf1.csv") %>% filter(year == 1950)
# Trying to calculate for the last place for a race
get_dead_last <- function(some_race_id) {
last <- df %>%
select(race_id, position, driver) %>%
filter(race_id == some_race_id) %>%
<!-- argentina start -->
<div class="row">
<div class="col-12"><h4>Argentina</h4></div>
</div>
<div class="row">
<div class="col-6">Confirmed Cases</div>
<div class="col-6 text-right"><span id="argentina_cases"></span></div>
</div>
<div class="row">
<div class="col-6">Deaths</div>
@lennymd
lennymd / filterSections.html
Last active April 23, 2020 03:54
Trying to filter sections made using d3 by using CSS and a selectButton
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cards test</title>
<style>
.hidden {
display: none;
@lennymd
lennymd / getFiles.py
Created February 15, 2020 21:16
How to get the paths for image files
# This script will search for all the
import glob, csv
# the name of your hard drive
hdName = "lennymartinezd"
# the name of the folder where all the POY images are on"
mainFolderName = "_photoExports"
mainFolderPath = "/Volumes/" + hdName + "/" + mainFolderName
# we'll use the json library to read the JSON file and the csv library to save the file as a CSV file.
import csv, json
# This is the path to your json file. In this case I'm running the python script from the same folder where my json is.
path_to_file = "art_of_asia.json"
# The first thing we do is load the JSON file using Python, which turns the whole object into a dictionary, with a lot of dictionaries inside.
with open(path_to_file) as file:
data = json.load(file)