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

NumPy & Pandas Examples for Class 11

The document provides comprehensive examples of using NumPy and Pandas in Python for data manipulation. It covers various functions and operations such as array properties, indexing, slicing, and statistical analysis for NumPy, as well as DataFrame creation, viewing, selecting, adding, deleting, filtering, and sorting for Pandas. Additionally, it includes methods for handling missing values, grouping, renaming, concatenation, and obtaining unique values.

Uploaded by

gautam0priyanshu
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)
5 views3 pages

NumPy & Pandas Examples for Class 11

The document provides comprehensive examples of using NumPy and Pandas in Python for data manipulation. It covers various functions and operations such as array properties, indexing, slicing, and statistical analysis for NumPy, as well as DataFrame creation, viewing, selecting, adding, deleting, filtering, and sorting for Pandas. Additionally, it includes methods for handling missing values, grouping, renaming, concatenation, and obtaining unique values.

Uploaded by

gautam0priyanshu
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

Class 11 AI: NumPy and Pandas – Full Function Examples

------------------------------------------------------

NUMPY EXAMPLE LIST

marks = [45, 67, 89, 72, 56]

arr = [Link](marks)

NUMPY FUNCTIONS SHOWN ON THIS ARRAY

Array Properties:

[Link] -> Shows dimensions

[Link] -> Number of dimensions

[Link] -> Total elements

[Link] -> Data type

Indexing and Slicing:

arr[0]

arr[1:4]

arr[:]

arr[-1]

Array Creation:

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

[Link](4)

[Link](1, 10, 2)

[Link](0, 1, 5)

Operations:

arr + 5

arr - 2

arr * 2

arr / 2

[Link]()

[Link]()
[Link]()

[Link]()

PANDAS EXAMPLE LIST

data = {

'Name': ['Aman','Riya','Karan','Tina'],

'Marks': [78, 85, 92, 67]

df = [Link](data)

PANDAS FUNCTIONS SHOWN ON THIS DATAFRAME

Viewing:

[Link]()

[Link]()

[Link]()

[Link]()

[Link]

[Link]

[Link]

Selecting:

df['Marks']

df[['Name','Marks']]

[Link][0]

[Link][0]

Adding:

df['Grade'] = ['B','A','A','C']

[Link](1, 'Age', [17,18,17,18])

Deleting:

[Link](columns=['Age'])
[Link]([2])

Filtering:

df[df['Marks'] > 80]

Missing Values:

[Link]()

[Link]()

[Link](0)

[Link]()

Sorting:

df.sort_values('Marks')

Grouping:

[Link]('Grade').mean()

Statistics:

[Link]()

[Link]()

[Link]()

[Link]()

[Link]()

Renaming and Index:

[Link](columns={'Marks':'Score'})

df.set_index('Name')

Concatenation & Merge:

[Link]([df, df])

[Link](df, df, on='Name')

Unique Values:

df['Grade'].unique()

df['Grade'].value_counts()

You might also like