Lab Assignment-1

Assignment-1- week 1 July

Learning Objective: Learn numpy, pandas ,matplotlib and seaborn

1. Learn creation and manipulation of NumPy arrays.

  • Create a 1-D array containing numbers 1 to 20.
  • Create a 4×5 matrix.
  • Find
    • Shape
    • Size
    • Number of dimensions
    • Data type
  • Reshape the matrix into 2×10.
  • Flatten the matrix.
  • Reverse the array.Find the maximum, minimum and average value.

  • 2.NumPy Arithmetic and Indexing


    Given

    A =
    [[10 20 30]
    [40 50 60]
    [70 80 90]]

    B =
    [[1 2 3]
    [4 5 6]
    [7 8 9]]

    Perform

    1. Addition
    2. Subtraction
    3. Multiplication
    4. Division
    5. Square every element
    6. Extract second row
    7. Extract first and third columns
    8. Replace all values greater than 50 with 0.

    3. Random Numbers and Statistics using NumPy

    Problem

    Generate marks of 100 students randomly between 35 and 100.

    Find

    • Mean
    • Median
    • Standard deviation
    • Variance
    • Highest mark
    • Lowest mark
    • Students scoring above 90
    • Students scoring below average

    Display the topper and bottom scorer.

    4.Linear Algebra using NumPy

    Problem

    Create two matrices

    A (3×3)

    B (3×3)

    Perform

    1. Matrix addition
    2. Matrix multiplication
    3. Transpose
    4. Determinant
    5. Inverse
    6. Eigenvalues
    7. Eigenvectors
    solve the following system of equations
    2x1+3x2 +5x3= 10
    3x1-2x2+x3=3
    x1+5x2+7x3=8

    5.Pandas Series and DataFrame


    Problem

    Create a DataFrame for 15 students.

    Columns

    RollNo
    Name
    Marks

    Perform

    1. Display first 5 rows.
    2. Display last 5 rows.
    3. Find average marks.
    4. Add Total.
    5. Add Percentage.
    6. Add Grade.
    7. Display students scoring above 85%.
    8. Sort according to percentage.

    6.Data Cleaning using Pandas

    Problem

    Create a CSV file containing

    Name
    Age
    Department
    Salary
    Experience

    Introduce

    • Missing values
    • Duplicate rows
    • Incorrect values

    Write a program to

    1. Read the CSV.
    2. Display information.
    3. Detect null values.
    4. Fill missing salary using average.
    5. Remove duplicates.
    6. Rename columns.
    7. Save cleaned data into another CSV.

    7.Data Analysis using Pandas


    Problem

    Consider sales data of an electronics shop.

    Columns

    Date
    Product
    Category
    Price
    Quantity
    City

    Find

    1. Total sales.
    2. Highest selling product.
    3. City with highest sales.
    4. Average quantity sold.
    5. Total sales category-wise.
    6. Top five transactions.
    7. Monthly sales.

    8.Matplotlib Visualization

    Problem

    Using student marks dataset,

    Draw

    1. Line chart
    2. Bar chart
    3. Pie chart
    4. Histogram
    5. Scatter plot

    9.Plot the following functions

    Write seperate functions for computing these functions
    1.ReLU
    2.Sigmoid
    3.tanh
    4.log

    draw all these in a single plot. Use subplot.

    10.Statistical Visualization using Seaborn

    Problem

    Using the famous Iris dataset,

    Create

    1. Scatter plot
    2. Pair plot
    3. Box plot
    4. Violin plot
    5. Histogram
    6. Heatmap of correlation matrix

    Interpret

    • Which feature separates species best?
    • Which feature has highest correlation?

    Comments

    Popular posts from this blog

    Machine Learning Lab PCCSL508 Semester 5 KTU CS 2024 Scheme manual - Dr Binu V P

    Explore California Housing Dataset