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
data_simple = [0.1, 0.2, 0.3, 0.7, 0.8, 0.9]' |
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
function fizzer() | |
for i in 1:100 | |
if i % 15 == 0 | |
x = "FizzBuzz" | |
elseif i % 5 == 0 | |
x = "Buzz" | |
elseif i % 3 == 0 | |
x = "Fizz" | |
else | |
x = i |
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
SELECT * | |
FROM UNNEST(GENERATE_ARRAY(1, 15)) AS num |
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
WITH | |
numbers AS ( | |
-- this is the same as before, but wrapped in a with statement | |
SELECT | |
* | |
FROM | |
UNNEST(GENERATE_ARRAY(1, 100)) AS num ) | |
SELECT | |
num, |
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
function fib(n) { | |
var numbers = [0, 1] // initialise the array | |
while (n > 1) { | |
var new_num = numbers[0] + numbers[1]; | |
numbers.shift(); // drop the first element | |
numbers.push(new_num); // add the new element to the end | |
n -= 1; | |
} | |
return numbers[n]; | |
} |
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 TEMP FUNCTION fibonacci(n INT64) | |
RETURNS INT64 | |
LANGUAGE js AS | |
""" | |
var numbers = [0, 1] | |
while (n > 1) { | |
var new_num = numbers[0] + numbers[1]; | |
numbers.shift(); | |
numbers.push(new_num); | |
n -= 1; |
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 TEMP FUNCTION fibonacci(n INT64) | |
RETURNS INT64 | |
LANGUAGE js AS | |
""" | |
var numbers = [0, 1] | |
while (n > 1) { | |
var new_num = numbers[0] + numbers[1]; | |
numbers.shift(); | |
numbers.push(new_num); | |
n -= 1; |
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 TEMP FUNCTION fibonacci(n INT64) | |
RETURNS INT64 | |
LANGUAGE js AS | |
""" | |
var numbers = [0, 1] | |
while (n > 1) { | |
var new_num = (numbers[0] + numbers[1]) % 1000000; | |
numbers.shift(); | |
numbers.push(new_num); | |
n -= 1; |
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
export LOCATION=europe-west2 | |
bq --location=$LOCATION mk --dataset \ | |
--default_table_expiration 7200 \ | |
--description "Tables for different file types" \ | |
files |
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
import pandas as pd | |
from sklearn import datasets | |
# load a toy dataset | |
data = datasets.load_boston() | |
boston_df = pd.DataFrame(data["data"], columns=data["feature_names"]) | |
# save as CSV | |
boston_df.to_csv("boston.csv", index=False) |
OlderNewer