為了圖文並茂,故而想要 Jupyter 筆記本上的許多小工具呦☆
jupyter-renderers/packages/geojson-extension/
geojson-extension
A JupyterLab extension for rendering GeoJSON
Requirements
- JupyterLab ^0.30.0
- Node.js >= 5
Install
sudo jupyter labextension install @jupyterlab/geojson-extension
誰知打算用『燈籠』
Lantern
An orchestration layer for plots and tables, dummy datasets, widgets, research, reports, and anything else a data scientist might need.
Note: Lantern Live has moved to tributary
Note: Email reports have moved to jupyterlab_email
Note: Publish
is removed in favor of Voila
Install
To install the base package from pip:
pip install pylantern
To Install from source:
make install
To install the JupyterLab extension:
jupyter labextension install pylantern
or from source:
make labextension
To enable the Jupyter server extension:
jupyter serverextension enable --py lantern
Or run the corresponding commands directly
Lantern relies on JupyterLab extensions:
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install plotlywidget
jupyter labextension install @jupyterlab/plotly-extension
jupyter labextension install jupyterlab_bokeh
jupyter labextension install qgrid
jupyter labextension install @jpmorganchase/perspective-jupyterlab
jupyter labextension install ipysheet
jupyter labextension install lineup_widget
The following are for work in-progress on master:
jupyter labextension install bqplot
……
Getting Started
Read the docs!
Data
照亮前行之路
sudo pip3 install pylantern
卻遭遇麻煩也☻
rock64@rock64:~ ipython3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import lantern as l
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-b3a41b239d6b>", line 1, in <module>
import lantern as l
File "/usr/local/lib/python3.5/dist-packages/lantern/__init__.py", line 2, in <module>
from .data import *
File "/usr/local/lib/python3.5/dist-packages/lantern/data/__init__.py", line 3, in <module>
from .other import person, people, company, companies, ticker, currency, trades, superstore
File "/usr/local/lib/python3.5/dist-packages/lantern/data/other.py", line 4, in <module>
import mimesis
File "/usr/local/lib/python3.5/dist-packages/mimesis/__init__.py", line 10, in <module>
from mimesis.providers import *
File "/usr/local/lib/python3.5/dist-packages/mimesis/providers/__init__.py", line 5, in <module>
from mimesis.providers.base import BaseProvider, BaseDataProvider
File "/usr/local/lib/python3.5/dist-packages/mimesis/providers/base.py", line 84
self._data: Dict[str, Any] = {}
^
SyntaxError: invalid syntax
當真關關難過,關關過耶?☻
Mimesis is fast and extremely easy to use Python package, which helps generate big volumes of fake data for a variety of purposes in a variety of languages. https://mimesis.name/
…
Mimesis – Fake Data Generator
Description
Mimesis is fast and extremely easy to use Python package, which helps generate big volumes of fake data for a variety of purposes in a variety of languages. The fake data can be particularly useful during software development and testing. For example, it could be used to populate a testing database, create beautiful JSON and XML files, anonymize data taken from a production service and etc.
……
Source code: Lib/typing.py
Note
The typing module has been included in the standard library on a provisional basis. New features might be added and API may change even between minor releases if deemed necessary by the core developers.
This module supports type hints as specified by PEP 484 and PEP 526. The most fundamental support consists of the types Any
, Union
, Tuple
, Callable
, TypeVar
, and Generic
. For full specification please see PEP 484. For a simplified introduction to type hints see PEP 483.
The function below takes and returns a string and is annotated as follows:
def greeting(name: str) -> str:
return 'Hello ' + name
In the function greeting
, the argument name
is expected to be of type str
and the return type str
. Subtypes are accepted as arguments.
………
大膽闖關改☺!
檔案: /usr/local/lib/python3.5/dist-packages/mimesis/providers/base.py
def __init__(self, locale: str = locales.DEFAULT_LOCALE,
seed: Seed = None) -> None:
"""Initialize attributes for data providers.
:param locale: Current locale.
:param seed: Seed to all the random functions.
"""
super().__init__(seed=seed)
self._data: Dict[str, Any] = {}
self._datafile = ''
self._setup_locale(locale)
self._data_dir = Path(__file__).parent.parent.joinpath('data')
def _setup_locale(self, locale: str = locales.DEFAULT_LOCALE) -> None:
"""Set up locale after pre-check.
:param str locale: Locale
:raises UnsupportedLocale: When locale is not supported.
self._data = {} # type is dict(str,any)
檔案: /usr/local/lib/python3.5/dist-packages/mimesis/providers/base.py 已更動
def __init__(self, locale: str = locales.DEFAULT_LOCALE,
seed: Seed = None) -> None:
"""Initialize attributes for data providers.
:param locale: Current locale.
:param seed: Seed to all the random functions.
"""
super().__init__(seed=seed)
self._data = {} # type is dict(str,any)
self._datafile = ''
self._setup_locale(locale)
self._data_dir = Path(__file__).parent.parent.joinpath('data')
def _setup_locale(self, locale: str = locales.DEFAULT_LOCALE) -> None:
"""Set up locale after pre-check.
:param str locale: Locale
:raises UnsupportedLocale: When locale is not supported.
果然沒有盡頭,天不從人願乎?★
rock64@rock64:~ git clone https://github.com/scaleway/python2-secrets
Cloning into 'python2-secrets'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 84 (delta 6), reused 13 (delta 5), pack-reused 66
Unpacking objects: 100% (84/84), done.
rock64@rock64:~ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
creating python2_secrets.egg-info
writing python2_secrets.egg-info/PKG-INFO
writing top-level names to python2_secrets.egg-info/top_level.txt
writing dependency_links to python2_secrets.egg-info/dependency_links.txt
writing manifest file 'python2_secrets.egg-info/SOURCES.txt'
reading manifest file 'python2_secrets.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python2_secrets.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/secrets
copying secrets/secrets.py -> build/lib/secrets
copying secrets/__init__.py -> build/lib/secrets
creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/secrets
copying build/lib/secrets/secrets.py -> build/bdist.linux-aarch64/egg/secrets
copying build/lib/secrets/__init__.py -> build/bdist.linux-aarch64/egg/secrets
byte-compiling build/bdist.linux-aarch64/egg/secrets/secrets.py to secrets.cpython-35.pyc
byte-compiling build/bdist.linux-aarch64/egg/secrets/__init__.py to __init__.cpython-35.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/python2_secrets-1.0.6-py3.5.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing python2_secrets-1.0.6-py3.5.egg
Copying python2_secrets-1.0.6-py3.5.egg to /usr/local/lib/python3.5/dist-packages
Adding python2-secrets 1.0.6 to easy-install.pth file
Installed /usr/local/lib/python3.5/dist-packages/python2_secrets-1.0.6-py3.5.egg
Processing dependencies for python2-secrets==1.0.6
Finished processing dependencies for python2-secrets==1.0.6
哪知道燈籠找到沒?
rock64@rock64:~$ ipython3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import lantern as l
In [2]: