This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create my_date_month custom field from existing date field my_date | |
MONTH(my_date) | |
// Create my_date_YYYYMM ucstom field from existing numeric field my_date and my_date_month | |
CASE | |
WHEN my_date_month=1 THEN CONCAT(YEAR(my_date),'01') | |
WHEN my_date_month=2 THEN CONCAT(YEAR(my_date),'02') | |
WHEN my_date_month=3 THEN CONCAT(YEAR(my_date),'03') | |
WHEN my_date_month=4 THEN CONCAT(YEAR(my_date),'04') | |
WHEN my_date_month=5 THEN CONCAT(YEAR(my_date),'05') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// View item: It should be executed when the product detail is shown. | |
dataLayer.push({ ecommerce: null }); | |
dataLayer.push({ | |
event: "view_item", | |
ecommerce: { | |
currency: "USD", | |
value: 7.77, | |
items: [ | |
{ | |
item_id: "SKU_12345", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From m/d/yyyy text to yyyy-mm-dd text. | |
=SUBSTITUTE(RIGHT(A4;4)&"-"&IF(LEN(A4)>9;LEFT(A4;2);"0"&LEFT(A4;1))&"-"&MID(A4;FIND("/";A4)+1;2);"/";"") | |
# From m/d/yyyy text to yyyy-mm-dd date. | |
=DATEVALUE(SUBSTITUTE(RIGHT(A4;4)&"-"&IF(LEN(A4)>9;LEFT(A4;2);"0"&LEFT(A4;1))&"-"&MID(A4;FIND("/";A4)+1;2);"/";"")) | |
# From text 3.5 to 3,50 number | |
=VALUE(SUBSTITUTE(B5;".";",")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datos <- structure(list(Genero = c(2, 1, 1, 2, 1, 1, 1, 2, 2, 2), | |
`1. En casa` = c(1, 3, 1, 3, 4, 2, 4, 5, 5, 5), | |
`2. Con la tele` = c(4, 2, 1, 2, 3, 3, 2, 1, 1, 1)), | |
row.names = c(NA, -10L), | |
class = c("tbl_df", "tbl", "data.frame")) | |
# Opción con stats::wilcox.test | |
datos |> | |
dplyr::select(-Genero) |> | |
purrr::map_df(function(x){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{python} | |
import csv | |
import requests | |
import time | |
# Open the CSV file and read the data | |
with open('data.csv', 'r') as file: | |
reader = csv.reader(file) | |
data = [row for row in reader] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.service import Service | |
from webdriver_manager.chrome import ChromeDriverManager | |
from selenium.webdriver.chrome.options import Options | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
import time | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable | |
from functools import reduce, partial | |
add_three = lambda x: x+3 | |
duplicate = lambda x: x*2 | |
#------- | |
ComposableFunction = Callable[[float], float] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><body> | |
<script> | |
function handle() { | |
console.log("handle") | |
window.myPolling = setTimeout(finish, 2000); | |
} | |
function finish() { | |
console.log("finish") | |
} | |
function fireAttribute(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kgl_competitions_data_download <- function(competition_id, file_name, path = ".") { | |
.kaggle_base_url <- "https://www.kaggle.com/api/v1" | |
url <- paste0(.kaggle_base_url, "/competitions/data/download/", competition_id, "/", file_name) | |
rcall <- httr::GET(url, httr::authenticate(Sys.getenv("KAGGLE_USER"), Sys.getenv("KAGGLE_KEY"), type = "basic")) | |
tmp <- tempfile() | |
download.file(rcall$url, tmp) | |
invisible(file.copy(tmp, paste0(path, "/", file_name))) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Execute f for each row of df | |
#' | |
#' @param df data.frame | |
#' @param f function | |
#' @return A data.frame with the result of executin g for each row of df. | |
#' @examples | |
#' row_split_map( | |
#' tibble(x = c(1, 2), y = c(2, 3)), | |
#' function(df) { | |
#' df %>% mutate( |