Python之Pyforest:Pyforest的簡介、安裝、使用方法之詳細攻略
Python之Pyforest:Pyforest的簡介、安裝、使用方法之詳細攻略
目錄
pyforest簡介
pyforest安裝
pyforest使用方法
pyforest簡介
-很無聊,因為進口的都是一樣的。這超出了你的能力范圍。
-缺少導入擾亂你的工作的自然流程。
-有時,您甚至可能需要查找確切的導入聲明。例如,import matplotlib。pyplot作為sklearn的plt '或'。整體進口GradientBoostingRegressor”
如果你能專注于使用這些圖書館呢?pyforest提供了以下剩余的解決方案:
-你可以像往常一樣使用你所有的庫。如果還沒有導入庫,則pyforest將導入庫并將導入語句添加到第一個Jupyter單元中。
-如果一個庫不被使用,它將不會被導入。
-你的筆記本保持可復制和共享沒有你浪費一個想法的imports。
1、使用pyforest
在您[安裝](#installation) pyforest和它的Jupyter擴展之后,您就可以像平常一樣繼續使用您最喜歡的Python數據科學命令——而不需要編寫imports__。
For example, if you want to read a CSV with pandas:
```python
df = pd.read_csv("titanic.csv")
```
pyforest will automatically import pandas for you and add the import statement to the first cell:
```python
import pandas as pd
```
pyforest安裝
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyforest
pyforest使用方法
# -*- coding: utf-8 -*-
from ._imports import *
from .utils import (
get_user_symbols,
install_extensions,
install_nbextension,
install_labextension,
)
user_symbols = get_user_symbols()
pyforest_imports = globals().copy().keys()
for import_symbol in pyforest_imports:
# don't overwrite symbols of the user
if import_symbol not in user_symbols.keys():
user_symbols[import_symbol] = eval(import_symbol)
# set __version__ attribute
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = "unknown"
finally:
del get_distribution, DistributionNotFound
def _jupyter_nbextension_paths():
return [
{
"section": "notebook",
"src": "static",
"dest": "pyforest",
"require": "pyforest/nbextension",
}
]
def _jupyter_labextension_paths():
return [{"name": "pyforest", "src": "static"}]
Python
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。