Drop a Column From a 2-D NumPy Array
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: easy
Interview Round: Other
Implement `drop_column(a, j)` that returns a new array equal to the 2-D NumPy array `a` with column `j` removed.
Requirements:
- Use `np.delete` along `axis=1`.
- Input shape `(m, n)` yields output shape `(m, n - 1)`.
- Do not mutate `a`. Return a fresh array.
For example:
```python
a = np.array([[1, 2, 3],
[4, 5, 6]])
drop_column(a, 1)
# array([[1, 3],
# [4, 6]])
```
```hint Check the axis argument
Look at what `np.delete` removes when you pass `axis=1`, and what it returns for this example if you leave `axis` out.
```
### Constraints & Assumptions
- `a` is 2-D with at least one column.
- `0 <= j < a.shape[1]`.
### What a Strong Answer Covers
- Removing along `axis=1`, and what `np.delete` does when `axis` is omitted
- The output shape, including a single-column input, and that `a` is left unchanged
- Whether the result is a copy or a view
- How to drop several columns without the positions shifting under you
### Follow-up Questions
- How would you drop multiple columns at once?
- Does `np.delete` copy or view the data, and is there any case where dropping a column can be done with a view?
Overview: Remove one column from a 2-D NumPy array with np.delete and return a fresh array of shape (m, n - 1). It tests axis semantics, what happens when the axis is omitted, copy versus view behavior, and dropping several columns without index-shift bugs.