This file contains hidden or 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
import ipydatagrid | |
import pandas as pd | |
from shinywidgets import output_widget, reactive_read, render_widget | |
from shiny import App, render, ui | |
# Create sample data | |
df = pd.DataFrame({ | |
'A': [1, 2, 3, 4], | |
'B': ['a', 'b', 'c', 'd'], |
This file contains hidden or 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
--- | |
title: A dbt model | |
--- | |
```{python} | |
#| echo: false | |
sql_path = "my_path.sql" | |
``` | |
## Columns |
This file contains hidden or 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 shiny import App, render, ui, reactive, module | |
from htmltools import TagList | |
app_ui = ui.page_fluid( | |
ui.row( | |
# add space from the left | |
ui.column(3), | |
# center with content | |
ui.column( | |
6, |
This file contains hidden or 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
import datetime | |
from typing import Dict, List, Optional, Tuple | |
import astropy.units as u | |
import matplotlib.dates as mpldates | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
import pytz | |
import suntime |
This file contains hidden or 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
library(tidyverse) | |
library(lubridate) | |
df <- tibble( | |
dist1 = sort(rnorm(100, 5, 2)), | |
dist2 = sort(rnorm(100, 8, 3)), | |
dist4 = sort(rnorm(100, 15, 1)), | |
date = seq.Date(from = ymd("2022-01-01"), ymd("2022-04-10"), by = "day") | |
) |
This file contains hidden or 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
library(tidyverse) | |
survey <- tibble::tribble( | |
~id, ~q_1, ~q_2, ~q_3, | |
1L, "good", "bad", "neutral", | |
2L, "neutral", "good", "neutral", | |
3L, "bad", "neutral", "neutral", | |
4L, "neutral", "good", "neutral", | |
5L, "bad", "good", "neutral", | |
6L, "bad", "bad", "neutral" |
This file contains hidden or 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
library(tidyverse) | |
library(janitor) | |
library(RcppRoll) | |
deaths <- read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv") | |
deaths <- deaths %>% | |
rename(province_state = `Province/State`, | |
country_region = `Country/Region`) %>% | |
pivot_longer(-c("province_state", "country_region", "Lat", "Long"), |
This file contains hidden or 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
library(tidyverse) | |
library(RcppRoll) | |
library(lubridate) | |
library(broom) | |
covid <- read_csv("https://covid.ourworldindata.org/data/owid-covid-data.csv") %>% | |
filter(location != "World") | |
covid <- covid %>% | |
group_by(iso_code) %>% |
This file contains hidden or 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
library(tidyverse) | |
library(rgeos) | |
library(RcppRoll) | |
library(rworldmap) | |
data <- read_csv("https://covid.ourworldindata.org/data/owid-covid-data.csv") %>% | |
filter(location != "World") | |
plot_df <- data %>% | |
group_by(iso_code) %>% |
This file contains hidden or 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
select_random <- function(tbl, n_records) { | |
tbl <- tbl %>% | |
dplyr::mutate(rand = random()) %>% | |
dplyr::compute() %>% | |
dplyr::arrange(.data$rand) %>% | |
dplyr::filter(dplyr::row_number(.data$rand) <= !!n_transactions) %>% | |
dplyr::select(-.data$rand) | |
} | |
tbl %>% |
NewerOlder