0% found this document useful (0 votes)
32 views3 pages

NumPy Pandas Complete Notes

The document provides a comprehensive overview of NumPy and Pandas, focusing on their functionalities and differences. It covers NumPy basics, including array creation, attributes, indexing, slicing, and descriptive statistics, as well as Pandas Series and DataFrames, detailing their creation, access, operations, and querying capabilities. Additionally, it compares NumPy and Pandas, highlighting that NumPy is suited for numerical arrays and smaller datasets, while Pandas is better for labeled, tabular data and larger datasets.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views3 pages

NumPy Pandas Complete Notes

The document provides a comprehensive overview of NumPy and Pandas, focusing on their functionalities and differences. It covers NumPy basics, including array creation, attributes, indexing, slicing, and descriptive statistics, as well as Pandas Series and DataFrames, detailing their creation, access, operations, and querying capabilities. Additionally, it compares NumPy and Pandas, highlighting that NumPy is suited for numerical arrays and smaller datasets, while Pandas is better for labeled, tabular data and larger datasets.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NUMPY & PANDAS – COMPLETE UNIT V STUDY NOTES

1. NUMPY BASICS

- NumPy is a library for fast numerical operations using arrays.

- Arrays are homogeneous and faster than lists.

- Supports vectorized operations.

Creating Arrays:

- [Link]([1,2,3])

- [Link]([[1,2],[3,4]])

- [Link](start, stop, step)

- [Link]((r,c)), [Link]((r,c)), [Link]((r,c), value)

- [Link](low, high, size)

Array Attributes:

- ndim, size, shape, dtype, itemsize, data

Indexing:

- a[2], a[-1]

- a[row, col]

Slicing:

- a[start:stop:step]

- Reverse: a[::-1]

- 2D slicing: a[:2,:2]

Descriptive Statistics:

- Percentile: [Link](a,50)

- Variance: [Link](a)
2. PANDAS SERIES

- Series = one-dimensional labeled array.

- s = [Link]([10,20,30])

- Custom index: [Link]([1,2], index=['a','b'])

- Access: s['a'], s[1]

Attributes:

- index, dtype, size, empty, hasnans, nbytes, ndim

3. DATAFRAMES

Creating:

df = [Link]({'A':[1,2], 'B':[3,4]})

Access:

- Column: df['A']

- Row (loc): [Link][row_label]

- Row (iloc): [Link][row_index]

Operations:

- Add column: df['C']=values

- Delete: del df['C']

- Transpose: df.T

- head(), tail(), info(), describe()

Selecting:

- [Link][], [Link][]

- [Link]("Age > 25")

- df.sort_values(), [Link](), [Link](), [Link]()

4. QUERYING DATAFRAMES
- Comparison queries: [Link]("Age > 25")

- Multiple conditions: [Link]("Age > 25 & City=='NY'")

- Using variables: [Link]("Age > @x")

- Checking membership: [Link]("City in ['NY','LA']")

5. NUMPY VS PANDAS

NumPy:

- Numerical arrays, faster for smaller datasets.

Pandas:

- Labeled, tabular data, easier for analysis, better for larger datasets.

END OF NOTES

You might also like