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 inspect | |
| begin_print = False | |
| module_print = True | |
| function_print = True | |
| for key, value in list(globals().items()): | |
| if begin_print and not key.endswith("_print"): | |
| # print imported module names if requested | |
| if module_print and inspect.ismodule(value): |
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
| DATE.EXP = LAMBDA(y, m, d, | |
| LET( | |
| mdJoin, CROSSJOIN(m, d), | |
| ymdJoin, CROSSJOIN(y, mdJoin), | |
| yearArray, CHOOSECOLS(ymdJoin, 1), | |
| monthArray, CHOOSECOLS(ymdJoin, 2), | |
| dayArray, CHOOSECOLS(ymdJoin, -1), | |
| SORT(MAP(yearArray, monthArray, dayArray, DATE)) | |
| ) | |
| ); |
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
| IFOMITTED = LAMBDA(arg, then, IF(ISOMITTED(arg),then,arg)); | |
| // Collapse a boolean array to a boolean vector | |
| COLLAPSE = LAMBDA( | |
| array, | |
| [collapse_with], // AND (default) or OR | |
| [collapse_to], // 0 (default) = column or 1 = row | |
| IF(collapse_to=0,BYROW,BYCOL)(array,IFOMITTED(collapse_with, AND)) | |
| ); |
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
| Option Explicit | |
| Public Sub TogglePythonCells() | |
| Dim cell As Range | |
| For Each cell In Selection | |
| If Left(cell.Formula2, 3) = "=PY" Then | |
| If cell.HasFormula Then | |
| cell.Formula2 = "'" & cell.Formula2 | |
| Else |
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 numpy as np | |
| import bisect | |
| import timeit | |
| import matplotlib.pyplot as plt | |
| # Initialize list to store results | |
| results = [] | |
| # Test for different array sizes | |
| test_values = [1000, 10000, 100000, 1000000, 10000000, 100000000] |
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 math | |
| from sympy import divisor_sigma, isprime | |
| import time | |
| t1 = time.time() | |
| results = [] | |
| n = 1 | |
| while len(results) < 50: | |
| if n > 2 and isprime(n): | |
| n += 1 |
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
| CHECKRANGE = LAMBDA(checkfn, | |
| LAMBDA(directionfn, | |
| LAMBDA(v, | |
| directionfn(v,LAMBDA(x,AND(checkfn(x)))) | |
| ))); | |
| CHECKISBLANK = CHECKRANGE(ISBLANK); | |
| CHECKBLANKROWS = CHECKISBLANK(BYROW); | |
| CHECKBLANKCOLS = CHECKISBLANK(BYCOL); | |
| TRIMRANGE2 =LAMBDA(sparseRange, [compressOrRemove], |
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
| # Create a KPI card | |
| card = KPICard(figsize=(4, 3)) | |
| # Add elements to the card | |
| card.add_title("Revenue") | |
| card.add_value(1234567, prefix="$", suffix="") | |
| card.add_change(12.5) # Will show with arrow | |
| card.add_subtitle("vs. Previous Month") | |
| card.add_border() |
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
| function main( | |
| workbook: ExcelScript.Workbook, | |
| outputRange: string = "A1", | |
| newSheetName: string = "Sheet Report" | |
| ) { | |
| const sheets = workbook.getWorksheets(); | |
| // Create or clear the report sheet | |
| let thisSheet = workbook.getWorksheet(newSheetName); | |
| if (thisSheet) { |
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
| {"OrderDate","Category","SubCategory","Product","SalesAmount","OrderQuantity";40541,"Bikes","Road Bikes","Road-150 Red, 62",3578.27,1;40541,"Bikes","Mountain Bikes","Mountain-100 Silver, 44",3399.99,1;40541,"Bikes","Mountain Bikes","Mountain-100 Silver, 44",3399.99,1;40541,"Bikes","Road Bikes","Road-650 Black, 62",699.0982,1;40541,"Bikes","Mountain Bikes","Mountain-100 Silver, 44",3399.99,1;40542,"Bikes","Road Bikes","Road-150 Red, 44",3578.27,1;40542,"Bikes","Road Bikes","Road-150 Red, 62",3578.27,1;40542,"Bikes","Mountain Bikes","Mountain-100 Black, 48",3374.99,1;40542,"Bikes","Mountain Bikes","Mountain-100 Silver, 38",3399.99,1;40543,"Bikes","Road Bikes","Road-150 Red, 48",3578.27,1;40543,"Bikes","Road Bikes","Road-150 Red, 48",3578.27,1;40543,"Bikes","Road Bikes","Road-650 Red, 52",699.0982,1;40543,"Bikes","Road Bikes","Road-150 Red, 52",3578.27,1;40543,"Bikes","Road Bikes","Road-150 Red, 56",3578.27,1;40544,"Bikes","Road Bikes","Road-150 Red, 56",3578.27,1;40544,"Bikes","Road Bikes","Road-150 Red, 44",35 |