So You Don’t Want To Waste Time to import Your Python Data Science Package ?

In this article, I will save your "import package" time

First of all, Install the Package by typing the code below on CMD

pip install pyforest

Secondly, Open your favorite Editor or IDE

from pyforest import *

How can this possible ? Just one line of CODE ! ! !

if you don’t believe me, you can test it with your own CSV file

from pyforest import *
df = pd.read_csv('test.csv')
df.head()

It’s magic

Now you can find that the csv file has been read

so What packages did it import ?

### Data Wrangling
pd = 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 Plotting
mpl = 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")# statistics
statistics = LazyImport("import statistics")
### Machine Learning
sklearn = 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 Learning
tf = LazyImport("import tensorflow as tf")
keras = LazyImport("import keras")
# NLP
nltk = LazyImport("import nltk")
gensim = LazyImport("import gensim")
spacy = LazyImport("import spacy")
re = LazyImport("import re")
### Helper
sys = 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")

Written by

Machine Learning / Deep Learning / Python / Flutter cakeresume.com/yanwei-liu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store