牛逼!这个Python库竟然可以偷懒,和import说再见!


pip install pyforestfrom pyforest import *active_imports()### Data Wranglingpd = LazyImport("import pandas as pd")np = LazyImport("import numpy as np")dd = LazyImport("from dask import dataframe as dd")SparkContext = LazyImport("from pyspark import SparkContext")load_workbook = LazyImport("from openpyxl import load_workbook")### Data Visualization and Plottingmpl = LazyImport("import matplotlib as mpl")plt = LazyImport("import matplotlib.pyplot as plt")sns = LazyImport("import seaborn as sns")py = LazyImport("import plotly as py")go = LazyImport("import plotly.graph_objs as go")px = LazyImport("import plotly.express as px")dash = LazyImport("import dash")bokeh = LazyImport("import bokeh")alt = LazyImport("import altair as alt")pydot = LazyImport("import pydot")# statisticsstatistics = LazyImport("import statistics")### Machine Learningsklearn = LazyImport("import sklearn")OneHotEncoder = LazyImport("from sklearn.preprocessing import OneHotEncoder")TSNE = LazyImport("from sklearn.manifold import TSNE")train_test_split = LazyImport("from sklearn.model_selection import train_test_split")svm = LazyImport("from sklearn import svm")GradientBoostingClassifier = LazyImport("from sklearn.ensemble import GradientBoostingClassifier")GradientBoostingRegressor = LazyImport("from sklearn.ensemble import GradientBoostingRegressor")RandomForestClassifier = LazyImport("from sklearn.ensemble import RandomForestClassifier")RandomForestRegressor = LazyImport("from sklearn.ensemble import RandomForestRegressor")TfidfVectorizer = LazyImport("from sklearn.feature_extraction.text import TfidfVectorizer")# TODO: add all the other most important sklearn objects# TODO: add separate sections within machine learning viz. Classification, Regression, Error Functions, Clustering# Deep Learningtf = LazyImport("import tensorflow as tf")keras = LazyImport("import keras")# NLPnltk = LazyImport("import nltk")gensim = LazyImport("import gensim")spacy = LazyImport("import spacy")re = LazyImport("import re")### Helpersys = LazyImport("import sys")os = LazyImport("import os")re = LazyImport("import re")glob = LazyImport("import glob")Path = LazyImport("from pathlib import Path")pickle = LazyImport("import pickle")dt = LazyImport("import datetime as dt")tqdm = LazyImport("import tqdm")
############################## User-specific imports ###############################You can save your own imports in ~/.pyforest/user_imports.pyPlease note: imports in ~/.pyforest/user_imports.py take precedence over theimports above.
PS:公号内回复「Python」即可进入Python 新手学习交流群,一起 100 天计划!
老规矩,兄弟们还记得么,右下角的 “在看” 点一下,如果感觉文章内容不错的话,记得分享朋友圈让更多的人知道!


【神秘礼包获取方式】
评论
