0% found this document useful (0 votes)
6 views

ML Practice

Uploaded by

ganeshbalaji765
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

ML Practice

Uploaded by

ganeshbalaji765
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

NumPy

NumPy (Numerical Python) is the fundamental package for scientific computing in Python. It provides
support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions
to operate on these arrays efficiently.

NumPy Example 1
# Importing NumPy Array

import numpy as np

# Creating an array using np.array() method

arr = np.array([10, 20, 30, 40, 50])

# Printing

print(arr) # Prints [10 20 30 40 50]

NumPy Example 2
Pandas
Pandas is an open-source data manipulation and analysis library built on top of NumPy. It
provides data structures and functions needed to manipulate structured data seamlessly.

Example 2:

import pandas as pd

df = pd.read_csv('iris.csv')

print(df)
print(df.to_string())

df.head()

df.tail()

df.head(10)

df.tail(10)

Matplotlib and Pyplot

Matplotlib is a comprehensive library for creating static, animated, and interactive

visualizations in Python. It is highly customizable and supports a wide range of plot

types.

Example 1:

import matplotlib.pyplot as plt

import numpy as np

x = np.linspace(0, 2 * np.pi, 200)

y = np.sin(x)

fig, ax = plt.subplots(figsize=(7, 4))

ax.set_title('Sin Wave')

ax.plot(x, y)

plt.show()
Example 2:

Seaborn

Seaborn is a Python visualization library based on Matplotlib that provides a high-level interface
for drawing attractive and informative statistical graphics.

You might also like