Sometimes, it happens that we spent a huge amount of time importing some common libraries like
NumPy
,
pandas
,
matplotlib
,
seaborn
,
nltk
and many more. To remove this headache of importing such libraries manually, we have
pyforest
library.
It is that library which helps you to work directly without importing other libraries separately.
It itself adds up some of the highly usable libraries used in
DataScience while we are using it.
Functions of pyforest :
- active_imports(): It will return all the libraries which have been used in the program.
- lazy_imports(): It will return all the libraries available in pyforest.
Installing Library:
pip install pyforest
Let's see the usage of pyforest
with various libraries.
- Numpy:
NumPy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays.
Example:
Python3
# here we have not import
# 'numpy as np' by explicitly
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print(a)
Output:
[[1 2 3]
[4 5 6]
[7 8 9]]
Note: For more information, refer to
NumPy in Python
Pandas: Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). A Data frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns. Pandas DataFrame consists of three principal components, the data, rows, and columns.
Example:
Python3
d = {'A':[1, 2, 3], 'B':[4, 5, 6], 'C':[7, 8, 9]}
# here we have not import
# 'pandas as pd' by ourself .
df = pd.DataFrame(d)
print(df)
Output:
A B C
0 1 4 7
1 2 5 8
2 3 6 9
Note: For more information, refer to
Python | Pandas DataFrame
NLTK: The
NLTK module is a massive tool kit, aimed at helping you with the entire Natural Language Processing (NLP) methodology.
Example:
Python3
# here we do not import
# ' Nltk library' by ourself
# but only the class of nltk .
from nltk.tokenize import word_tokenize
data = "All apples are red in colour"
print(word_tokenize(data))
Output:
['All', 'apples', 'are', 'red', 'in', 'colour']
Note: For more information, refer to
Tokenize text using NLTK in python
Matplotlib: Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack.
Example:
Python3
# here we have not imported
# 'matplotlib.pyplot as plt' by ourself.
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
plt.plot(x, y)
plt.show()
Output:
Note: For more information, refer to
Introduction to Matplotlib
Similar Reads
Introduction to Python Pydantic Library In modern Python development, data validation and parsing are essential components of building robust and reliable applications. Whether we're developing APIs, working with configuration files, or handling data from various sources, ensuring that our data is correctly validated and parsed is crucial
6 min read
What is python scikit library? Python is known for its versatility across various domains, from web development to data science and machine learning. In machine learning, one of the go-to libraries for Python enthusiasts is Scikit-learn, often referred to as "sklearn." It's a powerhouse for creating robust machine learning models
7 min read
Lazy import in Python In this article, we will learn how to do Lazy import in Python. For this, let's first understand the lazy import. What is Lazy Import? It is a feature of the Pyforest module that allows the user to perform the task without adding libraries to the code snippet as the task of this function is to add t
5 min read
External Modules in Python Python is one of the most popular programming languages because of its vast collection of modules which make the work of developers easy and save time from writing the code for a particular task for their program. Python provides various types of modules which include built-in modules and external m
5 min read
What is YFinance library? YFinance is a Python library that helps in accessing financial data from Yahoo Finance. It is widely used by investors, analysts and developers to find stock prices, historical market data and financial statements. In this article, we will see more about yfinance and its core concepts.It helps users
4 min read