Assignment 2
BUSI 520: Python for Business Research
Jones Graduate School of Business
Rice University

Numpy

  1. Creating Arrays:
    1. Create a one-dimensional array of integers from 0 to 9.
    2. Create a two-dimensional array of zeros with shape (5, 5).
    3. Create a three-dimensional array of ones with shape (2, 3, 4).
  2. Manipulating Arrays:
    1. Reshape the above two-dimensional array to a one-dimensional array.
    2. Stack two arrays horizontally and vertically.
    3. Split a given array into multiple sub-arrays.
    4. Flatten a multi-dimensional array.
    5. Expand the dimensions of a one-dimensional array.
  3. Array Indexing:
    1. Extract the third and fifth elements from a one-dimensional array.
    2. Extract a 2x2 sub-matrix from a given two-dimensional array.
    3. Use boolean indexing to extract even numbers from an array.
  4. Arithmetic Operations:
    1. Perform element-wise addition, subtraction, multiplication, and division on two given arrays.
    2. Multiply a 2x3 matrix with a 1x3 matrix using broadcasting.
  5. Aggregation Functions:
    1. Calculate the sum, mean, standard deviation, and variance of a one-dimensional array.
    2. Find the minimum and maximum values in a one-dimensional array.
    3. Repeat (a) and (b) along a single axis of a two-dimensional array.
  6. Linear Algebra:
    1. Transpose a matrix
    2. Multiply two matrices.
    3. Compute the dot product of two vectors.
    4. Calculate the determinant of a matrix.
    5. Compute the eigenvalues and eigenvectors of a matrix.
    6. Solve a system of linear equations using NumPy.
  7. Simulation:
    1. Simulate 100 steps of a random walk with standard normal innovations.
    2. Generate 1,000 simulations of the random walk from part (a). Compute the mean, median, and standard deviation of the terminal value across the 1,000 simulations.

Pandas

  1. Basics of pandas Series and DataFrames
    1. Create a series from a list of integers.
    2. Extract values at specific indices from the Series.
    3. Change the index of the series to alphabetical letters.
    4. Create a dataFrame from a dictionary of lists.
    5. Extract specific columns from the dataFrame.
    6. Add a new column to the dataFrame.
    7. Create a dataframe filled with random numbers.
  2. Basic DataFrame Operations:
    1. Calculate the summary statistics for a DataFrame column.
    2. Sort the dataFrame based on a specific column.
    3. Filter rows based on certain criteria.
    4. Replace specific values in a DataFrame.
    5. Rename columns.
    6. Map values in a column to other values using a dictionary.
  3. Missing values:
  1. Find all missing values in a DataFrame. b Fill missing values with zeros.
  2. Fill missing values in a column with the column’s mean value.
  3. Drop rows with missing data.
  4. Find duplicate rows.
  5. Drop all but the last row in each set of duplicate rows.
  1. Filtering and Aggregation:
  1. Using the ‘tips’ dataset, filter the rows where the total bill is greater than $10.
  2. Create a new column in the ‘tips’ dataset called ‘bill_per_person’ which is the total bill divided by the size of the party.
  3. Group by the ‘day’ column and compute the average total bill for each day.