Calligrams

    
    import pathlib, hvplot.pandas, notebook; from tonyfast.poser import λ
    %reload_ext tonyfast.literacy
    iframe = λ.partial('IPython.display.IFrame', width='100%', height=800)
    pictures = λ[pathlib.Path].methodcaller('glob', '*.jpg').drop(1)[list].sorted(key=lambda x: x.stat().st_ctime).map(str)[list]
    λ['requests_cache.install_cache']('calligrams')
    calligram = "C@𝔏𝔏👁𝓖ⓇⒶ𝔐"
Read More

Anyconfig First Look

python-anyconfig is a MIT licensed python library provides common APIs to load and dump configuration files in various formats with some useful features such as contents merge, templates, query, schema validation and generation support.

Read More

Pair Correlation Functions On Dataframes

I want improve the criteria for identifying workers of a hotel vs guests. I was thinking about identifying devices that were seen in the hotel for 3 consecutive days, more than 3 times a month. Is it possible to do that efficiently and stay inside of pandas? I was thinking resample/groupby ‘1D’ and ‘device_id’, but I need an efficient way to calculate consecutive days

Read More

Poser With Type Recording

    import toolz, abc, inspect, functools, typing, importlib, urllib, builtins, json, pathlib, operator, itertools, fnmatch
    from toolz.curried import *
Read More

Toolz Composition Poser

    import toolz, abc, inspect, functools, typing, importlib, urllib, builtins, json, pathlib, operator, itertools, fnmatch
    from toolz.curried import *
Read More

Quansight Events

    import pandas, requests_cache, requests, uritemplate
    from toolz.curried import *
    requests_cache.install_cache('qs')
Read More

Xonsh Compiler

    import xonsh.main, xonsh.execer, IPython, ast
    execer = xonsh.execer.Execer()
    class CachingCompiler(IPython.core.compilerop.CachingCompiler):
        def ast_parse(self, source, filename='<unknown>', symbol='exec'): 
            return globals()['execer']._parse_ctx_free(source + "\n", symbol, filename)[0] or ast.Module([])
Read More

Interactive Jinja Templates

Allowing code cells to accept Markdown requires different display behavior. An important feature of computational documents is the real data can be included within a narrative. In this document, we add the ability to template Markdown with jinja2. We’ll observe value changes and update the display with traitlets.

Read More

Inline Code

All code should compute, code for typographic decoration should require extra effort to suppress. As a rule, code in a document should work.

Read More

Doctest Post Run Cell

A common use for notebooks is to “test an idea”. Designing pathways to mature informal notebook to formal testing tools like doctest. This notebook implements the ability to doctest when a cell is run.

Read More

Fastapi Routes

Most canonical examples for fastapi use fastapi.FastAPI to instantiate an application. This notebook envisions a situation where an author has written several useful notebooks and they want to reuse as API’s. This is acheived with fastapi and importnb.

Read More

Importnb

    %reload_ext tonyfast
    __import__('requests_cache').install_cache('importnb'); import inspect, sys, IPython, nbformat, nbconvert, pathlib, json, pytest
Read More