Skip to content

dfinke/PSNotebookRunner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Runners

One PowerShell Jupyter Notebook, multiple experiments.

Simple experimentation with jupyter, PowerShell Invoke-ExcecuteNotebook, and parameters.

You need the PowerShellNotebook module installed for this to work. Install-Module -Name PowerShellNotebook

CSV Runner

Overview

Parameterize the basic.ipynb notebook with $index. It creates a new notebook with the $index in the name and reads a csv file based on the $index.

basic.ipynb

$index = !$index ? "SNP" : $index

$csvFilename = "$($pwd.path)/exenb/datadir/{0}.csv" -f $index
$records = import-csv $csvFilename

"$index record count: $($records.count)"

runner.ps1

foreach ($index in 'SNP', 'GOLD', 'SSE', 'HANGSENG', 'NIKKEI') {
    Invoke-ExecuteNotebook -Force `
        -InputNotebook ./basic.ipynb `
        -Parameters @{index = $index } `
        -OutputNotebook ('basic_{0}.ipynb' -f $index)
}

result

Creates these notebooks with results from the execution.

  • basic_GOLD.ipynb
  • basic_HANGSENG.ipynb
  • basic_NIKKEI.ipynb
  • basic_SNP.ipynb
  • basic_SSE.ipynb

XLRunner

Overview

The readExcel.ipynb notebook takes a required parameter an xlfile and two optional parameters sheetName and itemName.

sheetName defaults to the sheet name one in the notebook.

For example.

$params = @{
    xlfile   = (Resolve-Path ".\datadir\excelData.xlsx").Path
    itemName = 'hammer'
}

Invoke-ExecuteNotebook -InputNotebook .\readExcel.ipynb -Parameters $params
Region Item   TotalSold
------ ----   ---------
East   hammer        51
South  hammer        18

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published