About Lesson
Installing and Using Libraries
- Installation: Use
pip
, the Python package installer, to install third-party libraries. bashpip install numpy pip install pandas
- NumPy: A library for numerical computations.
- Features: Supports large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays.
python
import numpy as np arr = np.array([1, 2, 3, 4, 5]) print(arr) # Output: [1 2 3 4 5] print(np.mean(arr)) # Output: 3.0
- Pandas: A library for data manipulation and analysis.
- Features: Provides data structures like
Series
andDataFrame
for handling structured data.
python
import pandas as pd data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35]} df = pd.DataFrame(data) print(df) # Output: # Name Age # 0 Alice 25 # 1 Bob 30 # 2 Charlie 35
- Features: Provides data structures like